Skip to content
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
10 changes: 10 additions & 0 deletions src/Illuminate/Testing/Concerns/AssertsStatusCodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,16 @@ public function assertUnprocessable()
return $this->assertStatus(422);
}

/**
* Assert that the response has a 424 "Failed Dependency" status code.
*
* @return $this
*/
public function assertFailedDependency()
{
return $this->assertStatus(424);
}

/**
* Assert that the response has a 429 "Too Many Requests" status code.
*
Expand Down
19 changes: 19 additions & 0 deletions tests/Testing/TestResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1087,6 +1087,25 @@ public function testAssertUnprocessable(): void
$response->assertUnprocessable();
}

public function testAssertFailedDependency(): void
{
$response = TestResponse::fromBaseResponse(
(new Response)->setStatusCode(Response::HTTP_FAILED_DEPENDENCY)
);

$response->assertFailedDependency();

$response = TestResponse::fromBaseResponse(
(new Response)->setStatusCode(Response::HTTP_OK)
);

$this->expectException(AssertionFailedError::class);
$this->expectExceptionMessage("Expected response status code [424] but received 200.\nFailed asserting that 200 is identical to 424.");

$response->assertFailedDependency();
$this->fail();
}

public function testAssertClientError(): void
{
$statusCode = 400;
Expand Down
Loading