44
55namespace HttpSoft \Tests \Basis \Middleware ;
66
7+ use HttpSoft \Basis \Exception \BadRequestHttpException ;
78use HttpSoft \Basis \Middleware \BodyParamsMiddleware ;
89use HttpSoft \Message \Response ;
910use HttpSoft \Message \ServerRequest ;
10- use JsonException ;
1111use PHPUnit \Framework \TestCase ;
1212use Psr \Http \Message \ResponseInterface ;
1313use Psr \Http \Message \ServerRequestInterface ;
@@ -101,7 +101,7 @@ public function matchDataProvider(): array
101101 * @param string $contentType
102102 * @param string $requestBody
103103 * @param string $expectedBody
104- * @throws JsonException
104+ * @throws BadRequestHttpException
105105 */
106106 public function testProcessWithMatchData (string $ contentType , string $ requestBody , string $ expectedBody )
107107 {
@@ -156,7 +156,7 @@ public function mismatchDataProvider(): array
156156 * @dataProvider mismatchDataProvider
157157 * @param string $contentType
158158 * @param string $requestBody
159- * @throws JsonException
159+ * @throws BadRequestHttpException
160160 */
161161 public function testProcessWithMismatchData (string $ contentType , string $ requestBody )
162162 {
@@ -166,11 +166,11 @@ public function testProcessWithMismatchData(string $contentType, string $request
166166 $ this ->assertSame ('' , (string ) $ response ->getBody ());
167167 }
168168
169- public function testProcessThrowJsonExceptionForInvalidJsonBody (): void
169+ public function testProcessThrowBadRequestHttpExceptionForInvalidJsonBody (): void
170170 {
171171 $ request = $ this ->createServerRequest ('POST ' , 'application/json ' );
172172 $ request ->getBody ()->write ('{"name"}/value ' );
173- $ this ->expectException (JsonException ::class);
173+ $ this ->expectException (BadRequestHttpException ::class);
174174 $ this ->middleware ->process ($ request , $ this ->createRequestHandler ());
175175 }
176176
0 commit comments