From 2c1fcaaea855ae755eae474e8aed0f3ec9af6574 Mon Sep 17 00:00:00 2001 From: Ricardo Fiorani Date: Thu, 25 Oct 2018 18:05:45 +0200 Subject: [PATCH] Improved Response test coverage --- tests/Message/ResponseTest.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/Message/ResponseTest.php b/tests/Message/ResponseTest.php index 88c4298..c993f8b 100644 --- a/tests/Message/ResponseTest.php +++ b/tests/Message/ResponseTest.php @@ -2,6 +2,7 @@ namespace Omnipay\SagePay\Message; +use Omnipay\Common\Message\RequestInterface; use Omnipay\Tests\TestCase; class ResponseTest extends TestCase @@ -100,4 +101,25 @@ public function testDirectPurchaseWithToken() $this->assertTrue($response->isSuccessful()); $this->assertSame('{ABCDEFGH-ABCD-ABCD-ABCD-ABCDEFGHIJKL}', $response->getToken()); } + + + public function testRedirectMethodIsPost() + { + $httpResponse = new Response($this->prophesize(RequestInterface::class)->reveal(), []); + $this->assertEquals('POST', $httpResponse->getRedirectMethod()); + } + + public function testDataGetters() + { + $vPSTxId = (string) rand(0, 100); + $securityKey = (string) rand(0, 100); + $data = [ + 'VPSTxId' => $vPSTxId, + 'SecurityKey' => $securityKey, + ]; + $httpResponse = new Response($this->prophesize(RequestInterface::class)->reveal(), $data); + + $this->assertEquals($vPSTxId, $httpResponse->getVPSTxId()); + $this->assertEquals($securityKey, $httpResponse->getSecurityKey()); + } }