From 2a6437217549046019ca16e06215bf6df94e0544 Mon Sep 17 00:00:00 2001 From: Marco van Oort Date: Sat, 16 Dec 2023 16:42:44 +0100 Subject: [PATCH] Fix assertStatus() parameter order (#49404) --- src/Illuminate/Testing/TestResponse.php | 2 +- tests/Testing/TestResponseTest.php | 32 ++++++++++++------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/Illuminate/Testing/TestResponse.php b/src/Illuminate/Testing/TestResponse.php index c78cecb64c38..dc9b405c0565 100644 --- a/src/Illuminate/Testing/TestResponse.php +++ b/src/Illuminate/Testing/TestResponse.php @@ -144,7 +144,7 @@ public function assertStatus($status) { $message = $this->statusMessageWithDetails($status, $actual = $this->getStatusCode()); - PHPUnit::assertSame($actual, $status, $message); + PHPUnit::assertSame($status, $actual, $message); return $this; } diff --git a/tests/Testing/TestResponseTest.php b/tests/Testing/TestResponseTest.php index 6f565e981f8a..3934bbbebc13 100644 --- a/tests/Testing/TestResponseTest.php +++ b/tests/Testing/TestResponseTest.php @@ -596,7 +596,7 @@ public function testAssertMethodNotAllowed() ); $this->expectException(AssertionFailedError::class); - $this->expectExceptionMessage("Expected response status code [405] but received 200.\nFailed asserting that 405 is identical to 200."); + $this->expectExceptionMessage("Expected response status code [405] but received 200.\nFailed asserting that 200 is identical to 405."); $response->assertMethodNotAllowed(); } @@ -614,7 +614,7 @@ public function testAssertNotAcceptable() ); $this->expectException(AssertionFailedError::class); - $this->expectExceptionMessage("Expected response status code [406] but received 200.\nFailed asserting that 406 is identical to 200."); + $this->expectExceptionMessage("Expected response status code [406] but received 200.\nFailed asserting that 200 is identical to 406."); $response->assertNotAcceptable(); $this->fail(); @@ -665,7 +665,7 @@ public function testAssertBadRequest() ); $this->expectException(AssertionFailedError::class); - $this->expectExceptionMessage("Expected response status code [400] but received 200.\nFailed asserting that 400 is identical to 200."); + $this->expectExceptionMessage("Expected response status code [400] but received 200.\nFailed asserting that 200 is identical to 400."); $response->assertBadRequest(); $this->fail(); @@ -684,7 +684,7 @@ public function testAssertRequestTimeout() ); $this->expectException(AssertionFailedError::class); - $this->expectExceptionMessage("Expected response status code [408] but received 200.\nFailed asserting that 408 is identical to 200."); + $this->expectExceptionMessage("Expected response status code [408] but received 200.\nFailed asserting that 200 is identical to 408."); $response->assertRequestTimeout(); $this->fail(); @@ -703,7 +703,7 @@ public function testAssertPaymentRequired() ); $this->expectException(AssertionFailedError::class); - $this->expectExceptionMessage("Expected response status code [402] but received 200.\nFailed asserting that 402 is identical to 200."); + $this->expectExceptionMessage("Expected response status code [402] but received 200.\nFailed asserting that 200 is identical to 402."); $response->assertPaymentRequired(); $this->fail(); @@ -722,7 +722,7 @@ public function testAssertMovedPermanently() ); $this->expectException(AssertionFailedError::class); - $this->expectExceptionMessage("Expected response status code [301] but received 200.\nFailed asserting that 301 is identical to 200."); + $this->expectExceptionMessage("Expected response status code [301] but received 200.\nFailed asserting that 200 is identical to 301."); $response->assertMovedPermanently(); $this->fail(); @@ -741,7 +741,7 @@ public function testAssertFound() ); $this->expectException(AssertionFailedError::class); - $this->expectExceptionMessage("Expected response status code [302] but received 200.\nFailed asserting that 302 is identical to 200."); + $this->expectExceptionMessage("Expected response status code [302] but received 200.\nFailed asserting that 200 is identical to 302."); $response->assertFound(); $this->fail(); @@ -760,7 +760,7 @@ public function testAssertNotModified() ); $this->expectException(AssertionFailedError::class); - $this->expectExceptionMessage("Expected response status code [304] but received 200.\nFailed asserting that 304 is identical to 200."); + $this->expectExceptionMessage("Expected response status code [304] but received 200.\nFailed asserting that 200 is identical to 304."); $response->assertNotModified(); $this->fail(); @@ -779,7 +779,7 @@ public function testAssertTemporaryRedirect() ); $this->expectException(AssertionFailedError::class); - $this->expectExceptionMessage("Expected response status code [307] but received 200.\nFailed asserting that 307 is identical to 200."); + $this->expectExceptionMessage("Expected response status code [307] but received 200.\nFailed asserting that 200 is identical to 307."); $response->assertTemporaryRedirect(); $this->fail(); @@ -798,7 +798,7 @@ public function testAssertPermanentRedirect() ); $this->expectException(AssertionFailedError::class); - $this->expectExceptionMessage("Expected response status code [308] but received 200.\nFailed asserting that 308 is identical to 200."); + $this->expectExceptionMessage("Expected response status code [308] but received 200.\nFailed asserting that 200 is identical to 308."); $response->assertPermanentRedirect(); $this->fail(); @@ -817,7 +817,7 @@ public function testAssertConflict() ); $this->expectException(AssertionFailedError::class); - $this->expectExceptionMessage("Expected response status code [409] but received 200.\nFailed asserting that 409 is identical to 200."); + $this->expectExceptionMessage("Expected response status code [409] but received 200.\nFailed asserting that 200 is identical to 409."); $response->assertConflict(); $this->fail(); @@ -836,7 +836,7 @@ public function testAssertGone() ); $this->expectException(AssertionFailedError::class); - $this->expectExceptionMessage("Expected response status code [410] but received 200.\nFailed asserting that 410 is identical to 200."); + $this->expectExceptionMessage("Expected response status code [410] but received 200.\nFailed asserting that 200 is identical to 410."); $response->assertGone(); } @@ -854,7 +854,7 @@ public function testAssertTooManyRequests() ); $this->expectException(AssertionFailedError::class); - $this->expectExceptionMessage("Expected response status code [429] but received 200.\nFailed asserting that 429 is identical to 200."); + $this->expectExceptionMessage("Expected response status code [429] but received 200.\nFailed asserting that 200 is identical to 429."); $response->assertTooManyRequests(); $this->fail(); @@ -873,7 +873,7 @@ public function testAssertAccepted() ); $this->expectException(AssertionFailedError::class); - $this->expectExceptionMessage("Expected response status code [202] but received 200.\nFailed asserting that 202 is identical to 200."); + $this->expectExceptionMessage("Expected response status code [202] but received 200.\nFailed asserting that 200 is identical to 202."); $response->assertAccepted(); $this->fail(); @@ -920,7 +920,7 @@ public function testAssertInternalServerError() ); $this->expectException(AssertionFailedError::class); - $this->expectExceptionMessage("Expected response status code [500] but received 200.\nFailed asserting that 500 is identical to 200."); + $this->expectExceptionMessage("Expected response status code [500] but received 200.\nFailed asserting that 200 is identical to 500."); $response->assertInternalServerError(); } @@ -938,7 +938,7 @@ public function testAssertServiceUnavailable() ); $this->expectException(AssertionFailedError::class); - $this->expectExceptionMessage("Expected response status code [503] but received 200.\nFailed asserting that 503 is identical to 200."); + $this->expectExceptionMessage("Expected response status code [503] but received 200.\nFailed asserting that 200 is identical to 503."); $response->assertServiceUnavailable(); }