Skip to content

Commit 8851a62

Browse files
committed
Add notifyUrl tests
1 parent 96e3d31 commit 8851a62

File tree

3 files changed

+34
-3
lines changed

3 files changed

+34
-3
lines changed

src/Omnipay/PayPal/Message/ExpressAuthorizeRequest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ public function getData()
2929
$data['PAYMENTREQUEST_0_DESC'] = $this->getDescription();
3030
$data['PAYMENTREQUEST_0_NOTIFYURL'] = $this->getNotifyUrl();
3131

32-
3332
// pp express specific fields
3433
$data['SOLUTIONTYPE'] = $this->getSolutionType();
3534
$data['LANDINGPAGE'] = $this->getLandingPage();

tests/Omnipay/Common/Message/AbstractRequestTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,4 +143,10 @@ public function testCancelUrl()
143143
$this->assertSame($this->request, $this->request->setCancelUrl('https://www.example.com/cancel'));
144144
$this->assertSame('https://www.example.com/cancel', $this->request->getCancelUrl());
145145
}
146+
147+
public function testNotifyUrl()
148+
{
149+
$this->assertSame($this->request, $this->request->setNotifyUrl('https://www.example.com/notify'));
150+
$this->assertSame('https://www.example.com/notify', $this->request->getNotifyUrl());
151+
}
146152
}

tests/Omnipay/PayPal/Message/ExpressAuthorizeRequestTest.php

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,37 @@ public function setUp()
2929
);
3030
}
3131

32+
public function testGetData()
33+
{
34+
$this->request->initialize(array(
35+
'amount' => 1000,
36+
'currency' => 'AUD',
37+
'transactionId' => '111',
38+
'description' => 'Order Description'
39+
'returnUrl' => 'https://www.example.com/return',
40+
'cancelUrl' => 'https://www.example.com/cancel',
41+
'notifyUrl' => 'https://www.example.com/notify',
42+
'headerImageUrl' => 'https://www.example.com/header.jpg',
43+
));
44+
45+
$data = $this->request->getData();
46+
47+
$this->assertSame('10.00', $data['PAYMENTREQUEST_0_AMT']);
48+
$this->assertSame('AUD', $data['PAYMENTREQUEST_0_CURRENCYCODE']);
49+
$this->assertSame('111', $data['PAYMENTREQUEST_0_INVNUM']);
50+
$this->assertSame('Order Description', $data['PAYMENTREQUEST_0_DESC']);
51+
$this->assertSame('https://www.example.com/return', $data['RETURNURL']);
52+
$this->assertSame('https://www.example.com/cancel', $data['CANCELURL']);
53+
$this->assertSame('https://www.example.com/notify', $data['PAYMENTREQUEST_0_NOTIFYURL']);
54+
$this->assertSame('https://www.example.com/header.jpg', $data['HDRIMG']);
55+
}
56+
3257
public function testHeaderImageUrl()
3358
{
34-
$this->request->setHeaderImageUrl('https://www.example.com/image.jpg');
59+
$this->assertSame($this->request, $this->request->setHeaderImageUrl('https://www.example.com/header.jpg'));
60+
$this->assertSame('https://www.example.com/header.jpg', $this->request->getHeaderImageUrl());
3561

3662
$data = $this->request->getData();
37-
$this->assertEquals('https://www.example.com/image.jpg', $data['HDRIMG']);
63+
$this->assertEquals('https://www.example.com/header.jpg', $data['HDRIMG']);
3864
}
3965
}

0 commit comments

Comments
 (0)