Skip to content

Commit

Permalink
add a test to cover shipping option validation where there is no defa…
Browse files Browse the repository at this point in the history
…ult shipping option supplied
  • Loading branch information
bencromwell committed Nov 12, 2015
1 parent 67035b1 commit 7e2e440
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions tests/Message/ExpressAuthorizeRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7e2e440

Please sign in to comment.