I don't need the stack trace below when the PHPUnit assert fails, just my message ("Type: R Expected: 333.33333333333 Actual: 345") and the PHPUnit error message ("Failed assert that false is true") .
Is there a way to distinguish all my tests in try / catch blocks and remove the stack trace from the exception message before displaying it?
I really do not want the stack trace to disappear for any exceptions other than PHPUnit_Framework_ExpectationFailedException, however, if that is not possible, I could handle the loss of stack trace during all PHPUnit tests.
Other posts on SO seem to offer solutions to the opposite problem, returning a stack trace when xdebug disables it.
PHPUnit_Framework_ExpectationFailedException : Type: R Expected: 333.33333333333 Actual: 345 Failed asserting that false is true.
Update
This problem seems to be caused by the IDE (IntelliJ Idea and possibly PHPStorm), which does not call PHPUnit directly during unit testing, but through its own script, ide_phpunit.php. The problem does not occur when directly calling PHPUnit from the command line. This ide_phpunit.PHP script is created each time using the IDE, so the change is not so simple and does not look like writing protection from being overwritten. It may be a simple solution, but I put it in the βnot worth the effortβ basket.
jontyc
source share