Skip to content

Commit

Permalink
Fix assertRedirect making response headers matches the asserted URI f…
Browse files Browse the repository at this point in the history
…orm (#23176)
  • Loading branch information
adaroobi authored and taylorotwell committed Feb 15, 2018
1 parent ba3f3c0 commit a829ca7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Illuminate/Foundation/Testing/TestResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ public function assertRedirect($uri = null)
);

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

return $this;
Expand Down
4 changes: 4 additions & 0 deletions tests/Integration/Routing/RouteRedirectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,14 @@ public function test_route_redirect_with_params()
Route::redirect('from/{param}/{param2?}', 'to', 301);

$response = $this->get('/from/value1/value2');
$response->assertRedirect('to');

$this->assertEquals(301, $response->getStatusCode());
$this->assertEquals('to', $response->headers->get('Location'));

$response = $this->get('/from/value1');
$response->assertRedirect('to');

$this->assertEquals(301, $response->getStatusCode());
$this->assertEquals('to', $response->headers->get('Location'));
}
Expand Down

0 comments on commit a829ca7

Please sign in to comment.