Skip to content

Commit c36ea1e

Browse files
authored
Merge pull request #119 from ricardofiorani/improve-response-test-coverage
Improved Response test coverage
2 parents 691905d + 2c1fcaa commit c36ea1e

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/Message/ResponseTest.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Omnipay\SagePay\Message;
44

5+
use Omnipay\Common\Message\RequestInterface;
56
use Omnipay\Tests\TestCase;
67

78
class ResponseTest extends TestCase
@@ -100,4 +101,25 @@ public function testDirectPurchaseWithToken()
100101
$this->assertTrue($response->isSuccessful());
101102
$this->assertSame('{ABCDEFGH-ABCD-ABCD-ABCD-ABCDEFGHIJKL}', $response->getToken());
102103
}
104+
105+
106+
public function testRedirectMethodIsPost()
107+
{
108+
$httpResponse = new Response($this->prophesize(RequestInterface::class)->reveal(), []);
109+
$this->assertEquals('POST', $httpResponse->getRedirectMethod());
110+
}
111+
112+
public function testDataGetters()
113+
{
114+
$vPSTxId = (string) rand(0, 100);
115+
$securityKey = (string) rand(0, 100);
116+
$data = [
117+
'VPSTxId' => $vPSTxId,
118+
'SecurityKey' => $securityKey,
119+
];
120+
$httpResponse = new Response($this->prophesize(RequestInterface::class)->reveal(), $data);
121+
122+
$this->assertEquals($vPSTxId, $httpResponse->getVPSTxId());
123+
$this->assertEquals($securityKey, $httpResponse->getSecurityKey());
124+
}
103125
}

0 commit comments

Comments
 (0)