From a829ca764dc8ef6be8d592035e52821b3185e86d Mon Sep 17 00:00:00 2001 From: Amer Anwar Date: Thu, 15 Feb 2018 20:19:44 +0300 Subject: [PATCH] Fix assertRedirect making response headers matches the asserted URI form (#23176) --- src/Illuminate/Foundation/Testing/TestResponse.php | 4 +++- tests/Integration/Routing/RouteRedirectTest.php | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Foundation/Testing/TestResponse.php b/src/Illuminate/Foundation/Testing/TestResponse.php index 6c1f9fd67fab..ca5eacd20cb3 100644 --- a/src/Illuminate/Foundation/Testing/TestResponse.php +++ b/src/Illuminate/Foundation/Testing/TestResponse.php @@ -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; diff --git a/tests/Integration/Routing/RouteRedirectTest.php b/tests/Integration/Routing/RouteRedirectTest.php index d5316de717f8..8ae56e0e2536 100644 --- a/tests/Integration/Routing/RouteRedirectTest.php +++ b/tests/Integration/Routing/RouteRedirectTest.php @@ -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')); }