diff --git a/src/Illuminate/Foundation/Testing/TestResponse.php b/src/Illuminate/Foundation/Testing/TestResponse.php index 97f6ea4d98a3..6765fec80440 100644 --- a/src/Illuminate/Foundation/Testing/TestResponse.php +++ b/src/Illuminate/Foundation/Testing/TestResponse.php @@ -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. *