Immediate Exception Printer is a PHPUnit plug-in that prints out exceptions and assertion failures immediately during a test run. Normally PHPUnit keeps error details secret until the end of the test run, but sometimes we don't want to wait that long. With Immediate Exception Printer, all secrets are immediately revealed, with a few extra benefits, too.
- Immediately print out exceptions and assertion failures as they occur.
- Display the execution time of each test in tiered colour bands.
- Display the name of each test case as it is executed.
-
Add the library to your Composer file's
require-devsection."scriptfusion/phpunit-immediate-exception-printer": "^1"
-
Declare the printer class in your
phpunit.xmlconfiguration file.<phpunit printerClass="ScriptFUSION\PHPUnitImmediateExceptionPrinter\ImmediateExceptionPrinter" colors="true" >
-
Run the tests! If you didn't update
phpunit.xmlthe same options can be specified on the command-line instead.vendor/bin/phpunit --printer 'ScriptFUSION\PHPUnitImmediateExceptionPrinter\ImmediateExceptionPrinter' --color -
Enjoy immediate test execution feedback.
The following preview is somewhat atypical but shows all tested output cases this printer supports.
Not shown: the normal test summary output you're used to seeing at the end of a test run. This library makes no attempt to modify the summary; only runtime output is changed.
- PHP 5.6 or newer
- PHPUnit 5.5 or newer
Thanks to the following open source projects that inspired this project. Keep being awesome 👍.
- diablomedia/phpunit-pretty-printer – Design and implementation.
- whatthejeff/nyancat-phpunit-resultprinter – Testing.
- skyzyx/phpunit-result-printer – Design.
