Closed
Description
Description
Currently WebTestCase built in constraints are adding the whole httpresponse to the failure description. That is causing a wall of texts when a unit test breaks, resulting the cause of the error so far that I can't even scoll back to it.
Example
class IndexControllerTest extends WebTestCase
{
public function testIndex(): void
{
$client = self::createClient();
$client->enableProfiler();
$client->request('GET', '/investment');
self::assertResponseStatusCodeSame(Response::HTTP_OK);
}
}
Note the reducted 3000 lines between <html>
and </html>
PHPUnit 9.5.4 by Sebastian Bergmann and contributors.
Testing
F.....F 7 / 7 (100%)
Time: 00:00.850, Memory: 60.50 MB
There were 2 failures:
1) Tests\Controller\IndexControllerTest::testIndex
Failed asserting that the Response status code is 200.
HTTP/1.1 500 Internal Server Error
Cache-Control: max-age=0, must-revalidate, private
Content-Type: text/html; charset=UTF-8
Date: Fri, 16 Apr 2021 14:31:45 GMT
Expires: Fri, 16 Apr 2021 14:31:45 GMT
Set-Cookie: MOCKSESSID=e43f3895fa04294aab8b08747c023720e5b693c9280e015a445b2473fe98bc0a; path=/; secure; httponly; samesite=lax
X-Debug-Exception: An%20exception%20has%20been%20thrown%20during%20the%20rendering%20of%20a%20template%20%28%22Asset%20manifest%20file%20%22%2F...2Fpublic%2Fbuild%2Fmanifest.json%22%20does%20not%
20exist.%22%29.
X-Debug-Exception-File: ...%2Fbase.html.twig:9
X-Debug-Token: 033a1d
X-Previous-Debug-Token: 8d7c77
X-Robots-Tag: noindex
<!-- An exception has been thrown during the rendering of a template ("Asset manifest file "...public/build/manifest.json" does not exist."). (500 Internal Server Error) -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
... 3000 LINES OF HTML CSS JS CODE ESPECIALLY WITH PROFILER ENABLED
</html>
Caused by
ErrorException: An exception has been thrown during the rendering of a template ("Asset manifest file "/home...public/build/manifest.json" does not exist."). in ...base.html.twig:9
Stack trace:
#0...vendor/symfony/framework-bundle/Test/BrowserKitAssertionsTrait.php(33): Symfony\Bundle\FrameworkBundle\Test\WebTestCase::assertThatForResponse()
#1 .....
And without the linked additionalFailureDescription function:
PHPUnit 9.5.4 by Sebastian Bergmann and contributors.
Testing
F.....F 7 / 7 (100%)
Time: 00:00.826, Memory: 60.50 MB
There were 2 failures:
1) Tests\Controller\InvestmentControllerTest::testIndex
Failed asserting that the Response status code is 200.
.../vendor/symfony/framework-bundle/Test/BrowserKitAssertionsTrait.php:132
.../vendor/symfony/framework-bundle/Test/BrowserKitAssertionsTrait.php:38
.../tests/Controller/InvestmentControllerTest.php:33
Caused by
ErrorException: An exception has been thrown during the rendering of a template ("Asset manifest file ...public/build/manifest.json" does not exist."). in .../base.html.twig:9
Stack trace:
#0 .../vendor/symfony/framework-bundle/Test/BrowserKitAssertionsTrait.php(38): Symfony\Bundle\FrameworkBundle\Test\WebTestCase::assertThatForResponse()
#1.../tests/Controller/InvestmentControllerTest.php(33): Symfony\Bundle\FrameworkBundle\Test\WebTestCase::assertResponseStatusCodeSame()
#2.../vendor/phpunit/phpunit/src/Framework/TestCase.php(1526): Tests\Controller\InvestmentControllerTest->testIndex()
...
#13 {main}