Skip to content
This repository has been archived by the owner on Oct 30, 2020. It is now read-only.

Commit

Permalink
Adds item attached to a purchase test
Browse files Browse the repository at this point in the history
  • Loading branch information
Craig Paul committed Oct 26, 2016
1 parent 9fdb5ca commit b95b9fb
Showing 1 changed file with 27 additions and 6 deletions.
33 changes: 27 additions & 6 deletions tests/VaultTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ class VaultTest extends TestCase
*/
protected $customer;

/**
* @var array
*/
protected $items;

/**
* @var array
*/
Expand Down Expand Up @@ -71,11 +76,26 @@ public function setUp()
'tax3' => '1.03',
'shipping_cost' => '9.99',
];
$this->items = [
[
'name' => $faker->sentence(mt_rand(3, 6)),
'quantity' => '1',
'product_code' => $faker->isbn10,
'extended_amount' => $faker->randomFloat(2, 0.01, 999.99),
],
[
'name' => $faker->sentence(mt_rand(3, 6)),
'quantity' => '1',
'product_code' => $faker->isbn10,
'extended_amount' => $faker->randomFloat(2, 0.01, 999.99),
]
];
$this->customer = [
'email' => '[email protected]',
'instructions' => $faker->sentence(mt_rand(3, 6)),
'billing' => $this->billing,
'shipping' => $this->billing
'shipping' => $this->billing,
'items' => $this->items,
];
}

Expand Down Expand Up @@ -273,12 +293,13 @@ public function it_can_retrieve_all_expiring_credit_cards_from_the_moneris_vault
$this->assertTrue($response->successful);
$this->assertGreaterThan(0, count($receipt->read('data')));

foreach($cards as $index => $card) {
/** @var \CraigPaul\Moneris\Receipt $card */
$card = $card->receipt();
/** @var \CraigPaul\Moneris\Response $card */
foreach ($cards as $index => $card) {
/** @var \CraigPaul\Moneris\Receipt $rec */
$rec = $card->receipt();

$this->assertEquals($card->read('key'), $receipt->read('data')[$index]['data_key']);
$this->assertEquals($card->read('data')['masked_pan'], $receipt->read('data')[$index]['masked_pan']);
$this->assertEquals($rec->read('key'), $receipt->read('data')[$index]['data_key']);
$this->assertEquals($rec->read('data')['masked_pan'], $receipt->read('data')[$index]['masked_pan']);
}
}

Expand Down

0 comments on commit b95b9fb

Please sign in to comment.