File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -165,6 +165,21 @@ public function assertUnprocessable()
165
165
return $ this ->assertStatus (422 );
166
166
}
167
167
168
+ /**
169
+ * Assert that the response is a server error.
170
+ *
171
+ * @return $this
172
+ */
173
+ public function assertServerError ()
174
+ {
175
+ PHPUnit::assertTrue (
176
+ $ this ->isServerError (),
177
+ $ this ->statusMessageWithDetails ('>=500, < 600 ' , $ this ->getStatusCode ())
178
+ );
179
+
180
+ return $ this ;
181
+ }
182
+
168
183
/**
169
184
* Assert that the response has the given status code.
170
185
*
Original file line number Diff line number Diff line change @@ -580,6 +580,18 @@ public function testAssertUnprocessable()
580
580
$ response ->assertUnprocessable ();
581
581
}
582
582
583
+ public function testAssertServerError ()
584
+ {
585
+ $ statusCode = 500 ;
586
+
587
+ $ baseResponse = tap (new Response , function ($ response ) use ($ statusCode ) {
588
+ $ response ->setStatusCode ($ statusCode );
589
+ });
590
+
591
+ $ response = TestResponse::fromBaseResponse ($ baseResponse );
592
+ $ response ->assertServerError ();
593
+ }
594
+
583
595
public function testAssertNoContentAsserts204StatusCodeByDefault ()
584
596
{
585
597
$ statusCode = 500 ;
You can’t perform that action at this time.
0 commit comments