Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[10.x] Fix assertStatus() parameter order #49404

Merged
merged 1 commit into from
Dec 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Illuminate/Testing/TestResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
32 changes: 16 additions & 16 deletions tests/Testing/TestResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand All @@ -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();
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
}
Expand All @@ -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();
Expand All @@ -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();
Expand Down Expand Up @@ -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();
}
Expand All @@ -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();
}
Expand Down