diff --git a/src/JonnyW/PhantomJs/Http/Response.php b/src/JonnyW/PhantomJs/Http/Response.php index 6a89424..9ec5291 100644 --- a/src/JonnyW/PhantomJs/Http/Response.php +++ b/src/JonnyW/PhantomJs/Http/Response.php @@ -64,7 +64,7 @@ class Response * @var string * @access public */ - public $redirectUrl; + public $redirectURL; /** * Request time string @@ -209,7 +209,7 @@ public function getUrl() */ public function getRedirectUrl() { - return $this->redirectUrl; + return $this->redirectURL; } /** diff --git a/src/JonnyW/PhantomJs/Tests/Integration/ClientTest.php b/src/JonnyW/PhantomJs/Tests/Integration/ClientTest.php index cfb8d35..ee7792f 100644 --- a/src/JonnyW/PhantomJs/Tests/Integration/ClientTest.php +++ b/src/JonnyW/PhantomJs/Tests/Integration/ClientTest.php @@ -243,6 +243,28 @@ public function testResponseContainsHeaders() $this->assertNotEmpty($response->getHeaders()); } + + /** + * Test redirect URL is set in response + * if request is redirected. + * + * @access public + * @return void + */ + public function testRedirectUrlIsSetInResponseIfRequestIsRedirected() + { + $client = $this->getClient(); + + $request = $client->getMessageFactory()->createRequest(); + $response = $client->getMessageFactory()->createResponse(); + + $request->setMethod('GET'); + $request->setUrl('https://jigsaw.w3.org/HTTP/300/302.html'); + + $client->send($request, $response); + + $this->assertNotEmpty($response->getRedirectUrl()); + } /** * Test POST request sends request data. diff --git a/src/JonnyW/PhantomJs/Tests/Unit/Http/ResponseTest.php b/src/JonnyW/PhantomJs/Tests/Unit/Http/ResponseTest.php index 931eff2..94c6837 100644 --- a/src/JonnyW/PhantomJs/Tests/Unit/Http/ResponseTest.php +++ b/src/JonnyW/PhantomJs/Tests/Unit/Http/ResponseTest.php @@ -103,7 +103,7 @@ public function testUrlCanBeImported() public function testRedirectUrlCanBeImported() { $data = array( - 'redirectUrl' => 'http://test.com' + 'redirectURL' => 'http://test.com' ); $response = $this->getResponse();