I tested this exception with something like this:
\n// the database is empty\n\n$this->testClient->request('GET', '/badges/fooooo');\n\nself::assertPageTitleContains('No badge found (404 Not Found)');But after I upgraded to Symfony 7.4.0, I can’t test the <title> anymore, I replaced it with self::assertResponseStatusCodeSame(404); because the <title> wasn’t available anymore.
It’s also visible in this PHPUnit test: https://github.com/liip/LiipFunctionalTestBundle/actions/runs/19837319935/job/56837621771
\nThere is a test controller that do only this: throw new \\Exception('foo');
And before Symfony 7.4, foo was visible in <title>. Now the error page returns a text stack trace instead of a HTML page.
I had to add extra code to cover this case:
\n\nWhat commit, PR, etc. changed this behaviour? I tried to search for HTTP and exceptions in https://github.com/symfony/symfony/blob/7.4/CHANGELOG-7.4.md and https://github.com/symfony/symfony/blob/7.4/UPGRADE-7.4.md but I’m probably missing the right keyword.
\nCan the old behaviour be restored with some conf?
\nSo far, it looks like it’s due to the VarDumper component but it can’t find more information.
It may be related to:
\nHere is a workaround: put this in phpunit.xml.dist to restore the previous behaviour:
<php>\n <env name=\"APP_RUNTIME_MODE\" value=\"web=1\"/>\n </php>-
ContextExample 1I have this code in a controller: $site = $siteRepository
->findOneBy([
'apiSiteParameter' => $api_site_parameter,
])
;
if (!$site instanceof Site) {
throw $this->createNotFoundException('No site found');
}I tested this exception with something like this: // the database is empty
$this->testClient->request('GET', '/badges/fooooo');
self::assertPageTitleContains('No badge found (404 Not Found)');But after I upgraded to Symfony 7.4.0, I can’t test the Example 2It’s also visible in this PHPUnit test: https://github.com/liip/LiipFunctionalTestBundle/actions/runs/19837319935/job/56837621771 There is a test controller that do only this: And before Symfony 7.4, I had to add extra code to cover this case: QuestionWhat commit, PR, etc. changed this behaviour? I tried to search for HTTP and exceptions in https://github.com/symfony/symfony/blob/7.4/CHANGELOG-7.4.md and https://github.com/symfony/symfony/blob/7.4/UPGRADE-7.4.md but I’m probably missing the right keyword. Can the old behaviour be restored with some conf? So far, it looks like it’s due to the |
Beta Was this translation helpful? Give feedback.
-
|
It may be related to:
Here is a workaround: put this in <php>
<env name="APP_RUNTIME_MODE" value="web=1"/>
</php>
|
Beta Was this translation helpful? Give feedback.
It may be related to:
Here is a workaround: put this in
phpunit.xml.distto restore the previous behaviour: