Skip to content

Commit

Permalink
Add integration test for malformed requests
Browse files Browse the repository at this point in the history
  • Loading branch information
jnoordsij committed Mar 14, 2024
1 parent d256fc8 commit 3d66a96
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/Integration/Foundation/ExceptionHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,21 @@ public function testItHasFallbackErrorMessageForUnknownStatusCodes()
]);
}

public function testItReturns400CodeOnMalformedRequests()
{
// HTTP request...
$this->post('test-route', ['_method' => '__construct'])
->assertStatus(400)
->assertSeeText('Bad Request'); // see https://github.com/symfony/symfony/blob/1d439995eb6d780531b97094ff5fa43e345fc42e/src/Symfony/Component/ErrorHandler/Resources/views/error.html.php#L12

// JSON request...
$this->postJson('test-route', ['_method' => '__construct'])
->assertStatus(400)
->assertExactJson([
'message' => 'Bad request.',
]);
}

/**
* @dataProvider exitCodesProvider
*/
Expand Down

0 comments on commit 3d66a96

Please sign in to comment.