Skip to content

Commit

Permalink
Added assertUri method to TestReponse
Browse files Browse the repository at this point in the history
  • Loading branch information
gsingh1 committed May 21, 2018
1 parent b8e2cd0 commit 4294b3c
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/Illuminate/Foundation/Testing/TestResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,28 @@ public function assertRedirect($uri = null)
$this->isRedirect(), 'Response status code ['.$this->getStatusCode().'] is not a redirect status code.'
);

if (! is_null($uri)) {
PHPUnit::assertEquals(
app('url')->to($uri), app('url')->to($this->headers->get('Location'))
);
if (!is_null($uri)) {
$this->assertUri($uri);
}

return $this;
}

/**
* Assert whether the response location is to a given URI.
*
* @param string $uri
* @return $this
*/
public function assertUri($uri)
{
PHPUnit::assertEquals(
app('url')->to($uri), app('url')->to($this->headers->get('Location'))
);

return $this;
}

/**
* Asserts that the response contains the given header and equals the optional value.
*
Expand Down

0 comments on commit 4294b3c

Please sign in to comment.