Description
Description
Recently, when running some PHPUnit tests in a CI service, I saw these failing tests:
1) App\Tests\Controller\SomeControllerTest::testSomething with data set #0 ('...', '..', '...')
Failed asserting that the Response has header "Content-Type" with value "application/pdf".
I spent some time debugging the problem because I recently fixed this feature and I knew it worked on my local computer, on the server, etc. So, why was it failing only in the CI service? I had to SSH-login into it, debug things manually, etc. At the end, a simple dd($this->client->getResponse())
showed the real problem:
<title>An exception has been thrown during the rendering of a template
("file_get_contents(/home/circleci/project/public/build/some-file.css):
failed to open stream: No such file or directory"). (500 Internal Server Error)</title>
As you can see, the Symfony exception message is perfect and tells you the problem instantly .. while the PHPUnit error message only confuses you.
Possible solution
All these would have been solved if PHPUnit failing tests showed the real exception message from Symfony. Could we add that to the error messages shown by PHPUnit? Thanks!