File tree 2 files changed +27
-0
lines changed 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -131,6 +131,21 @@ public function assertSuccessfulPrecognition()
131
131
return $ this ;
132
132
}
133
133
134
+ /**
135
+ * Assert that the response is a client error.
136
+ *
137
+ * @return $this
138
+ */
139
+ public function assertClientError ()
140
+ {
141
+ PHPUnit::withResponse ($ this )->assertTrue (
142
+ $ this ->isClientError (),
143
+ $ this ->statusMessageWithDetails ('>=400, < 500 ' , $ this ->getStatusCode ())
144
+ );
145
+
146
+ return $ this ;
147
+ }
148
+
134
149
/**
135
150
* Assert that the response is a server error.
136
151
*
Original file line number Diff line number Diff line change @@ -1086,6 +1086,18 @@ public function testAssertUnprocessable()
1086
1086
$ response ->assertUnprocessable ();
1087
1087
}
1088
1088
1089
+ public function testAssertClientError ()
1090
+ {
1091
+ $ statusCode = 400 ;
1092
+
1093
+ $ baseResponse = tap (new Response , function ($ response ) use ($ statusCode ) {
1094
+ $ response ->setStatusCode ($ statusCode );
1095
+ });
1096
+
1097
+ $ response = TestResponse::fromBaseResponse ($ baseResponse );
1098
+ $ response ->assertClientError ();
1099
+ }
1100
+
1089
1101
public function testAssertServerError ()
1090
1102
{
1091
1103
$ statusCode = 500 ;
You can’t perform that action at this time.
0 commit comments