This repository has been archived by the owner on Oct 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds item attached to a purchase test
- Loading branch information
Craig Paul
committed
Oct 26, 2016
1 parent
9fdb5ca
commit b95b9fb
Showing
1 changed file
with
27 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,11 @@ class VaultTest extends TestCase | |
*/ | ||
protected $customer; | ||
|
||
/** | ||
* @var array | ||
*/ | ||
protected $items; | ||
|
||
/** | ||
* @var array | ||
*/ | ||
|
@@ -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, | ||
]; | ||
} | ||
|
||
|
@@ -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']); | ||
} | ||
} | ||
|
||
|