File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed
src/Illuminate/Testing/Concerns Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -221,6 +221,16 @@ public function assertUnprocessable()
221221 return $ this ->assertStatus (422 );
222222 }
223223
224+ /**
225+ * Assert that the response has a 424 "Failed Dependency" status code.
226+ *
227+ * @return $this
228+ */
229+ public function assertFailedDependency ()
230+ {
231+ return $ this ->assertStatus (424 );
232+ }
233+
224234 /**
225235 * Assert that the response has a 429 "Too Many Requests" status code.
226236 *
Original file line number Diff line number Diff line change @@ -1087,6 +1087,25 @@ public function testAssertUnprocessable(): void
10871087 $ response ->assertUnprocessable ();
10881088 }
10891089
1090+ public function testAssertFailedDependency (): void
1091+ {
1092+ $ response = TestResponse::fromBaseResponse (
1093+ (new Response )->setStatusCode (Response::HTTP_FAILED_DEPENDENCY )
1094+ );
1095+
1096+ $ response ->assertFailedDependency ();
1097+
1098+ $ response = TestResponse::fromBaseResponse (
1099+ (new Response )->setStatusCode (Response::HTTP_OK )
1100+ );
1101+
1102+ $ this ->expectException (AssertionFailedError::class);
1103+ $ this ->expectExceptionMessage ("Expected response status code [424] but received 200. \nFailed asserting that 200 is identical to 424. " );
1104+
1105+ $ response ->assertFailedDependency ();
1106+ $ this ->fail ();
1107+ }
1108+
10901109 public function testAssertClientError (): void
10911110 {
10921111 $ statusCode = 400 ;
You can’t perform that action at this time.
0 commit comments