5 use Omnipay\Tests\TestCase;
8 class ExpressAuthorizeResponseTest
extends TestCase
15 $this->assertEquals(array(
'example' =>
'value',
'foo' =>
'bar'), $response->getData());
20 $httpResponse = $this->getMockHttpResponse(
'ExpressPurchaseSuccess.txt');
21 $request = $this->getMockRequest();
22 $request->shouldReceive(
'getTestMode')->once()->andReturn(
true);
25 $this->assertFalse($response->isPending());
26 $this->assertFalse($response->isSuccessful());
27 $this->assertSame(
'EC-42721413K79637829', $response->getTransactionReference());
28 $this->assertNull($response->getMessage());
29 $this->assertNull($response->getRedirectData());
30 $this->assertSame(
'https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&useraction=commit&token=EC-42721413K79637829', $response->getRedirectUrl());
31 $this->assertSame(
'GET', $response->getRedirectMethod());
36 $httpResponse = $this->getMockHttpResponse(
'ExpressPurchaseFailure.txt');
39 $this->assertFalse($response->isPending());
40 $this->assertFalse($response->isSuccessful());
41 $this->assertNull($response->getTransactionReference());
42 $this->assertNull($response->getTransactionReference());
43 $this->assertSame(
'This transaction cannot be processed. The amount to be charged is zero.', $response->getMessage());