public function testAuthorizeSuccess() { $httpResponse = $this->getMockHttpResponse('AuthorizeSuccess.txt'); $response = new Response($this->getMockRequest(), $httpResponse->json()); $this->assertTrue($response->isSuccessful()); $this->assertFalse($response->isRedirect()); $this->assertSame('MTQ0NjgzMTQ5OArABirnISnF5KCCbyjn', $response->getTransactionReference()); $this->assertNull($response->getCardReference()); $this->assertNull($response->getMessage()); }
public function testRedirect() { $httpResponse = $this->getMockHttpResponse('PurchaseRedirect.txt'); $request = m::mock('\\Omnipay\\Common\\Message\\AbstractRequest'); $request->shouldReceive('getReturnUrl')->once()->andReturn('http://sanalmagaza.org/'); $response = new Response($request, $httpResponse->getBody()); $this->assertTrue($response->isRedirect()); $this->assertSame('POST', $response->getRedirectMethod()); $this->assertSame('http://sanalmagaza.org/', $response->getRedirectUrl()); $expectedData = array('ReturnUrl' => 'http://sanalmagaza.org/', 'ReferanceId' => '130215141054377801316798'); $this->assertEquals($expectedData, $response->getRedirectData()); }