Closed
Description
Symfony version(s) affected: 4.3 (at least)
Description
In the context of a functional test, if the tested page throws an exception, it is silenced by Symfony. Instead of having a failing PHPUnit test, the error page (with the ghost) is generated and no exceptions are thrown. This lead to uncaught exceptions, or cryptic errors at the following assertion.
How to reproduce
<?php
namespace App\Tests;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class ItemControllerTest extends WebTestCase
{
public function testCreateItem(): void
{
$client = static::createClient();
$client->request('GET', '/page-throwing-an-exception');
// This test is green, but shouldn't
}
Possible Solution
Throw instead of generating the error page when in the context of a functional test.
Metadata
Metadata
Assignees
Labels
No labels