Skip to content

Commit

Permalink
Redirect URL is always blank due to wrong case - #64
Browse files Browse the repository at this point in the history
  • Loading branch information
jonnnnyw committed Feb 2, 2016
1 parent 3a9e11e commit 030ee31
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/JonnyW/PhantomJs/Http/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class Response
* @var string
* @access public
*/
public $redirectUrl;
public $redirectURL;

/**
* Request time string
Expand Down Expand Up @@ -209,7 +209,7 @@ public function getUrl()
*/
public function getRedirectUrl()
{
return $this->redirectUrl;
return $this->redirectURL;
}

/**
Expand Down
22 changes: 22 additions & 0 deletions src/JonnyW/PhantomJs/Tests/Integration/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/JonnyW/PhantomJs/Tests/Unit/Http/ResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public function testUrlCanBeImported()
public function testRedirectUrlCanBeImported()
{
$data = array(
'redirectUrl' => 'http://test.com'
'redirectURL' => 'http://test.com'
);

$response = $this->getResponse();
Expand Down

0 comments on commit 030ee31

Please sign in to comment.