-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add a test to cover shipping option validation where there is no defa…
…ult shipping option supplied
- Loading branch information
1 parent
67035b1
commit 7e2e440
Showing
1 changed file
with
36 additions
and
0 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 |
---|---|---|
|
@@ -275,6 +275,42 @@ public function testDataWithCallback() | |
$this->assertSame(10, $data['CALLBACKTIMEOUT']); | ||
} | ||
|
||
public function testDataWithCallbackAndNoDefaultShippingOption() | ||
{ | ||
$baseData = array( | ||
'amount' => '10.00', | ||
'currency' => 'AUD', | ||
'transactionId' => '111', | ||
'description' => 'Order Description', | ||
'returnUrl' => 'https://www.example.com/return', | ||
'cancelUrl' => 'https://www.example.com/cancel', | ||
'subject' => '[email protected]', | ||
'headerImageUrl' => 'https://www.example.com/header.jpg', | ||
'allowNote' => 0, | ||
'addressOverride' => 0, | ||
'brandName' => 'Dunder Mifflin Paper Company, Incy.', | ||
); | ||
|
||
$shippingOptions = array( | ||
new ShippingOption('First Class', 1.20, false, '1-2 days'), | ||
new ShippingOption('Second Class', 0.70, false, '3-5 days'), | ||
new ShippingOption('International', 3.50), | ||
); | ||
|
||
// with a default callback timeout | ||
$this->request->initialize(array_merge($baseData, array( | ||
'callback' => 'https://www.example.com/calculate-shipping', | ||
'shippingOptions' => $shippingOptions, | ||
))); | ||
|
||
$this->setExpectedException( | ||
'\Omnipay\Common\Exception\InvalidRequestException', | ||
'One of the supplied shipping options must be set as default' | ||
); | ||
|
||
$this->request->getData(); | ||
} | ||
|
||
public function testNoAmount() | ||
{ | ||
$baseData = array(// nothing here - should cause a certain exception | ||
|