Collision is an error reporting tool for PHP command line applications. It ships as a dev dependency for Laravel starting back in Laravel 5.6, but I recently noticed the package’s author mention the PHPUnit adapter:
— NUNO MADURO (@enunomaduro) December 30, 2019
While collision ships with Laravel, you need to configure the listener if you want to use it with PHPUnit. I thought I’d quickly demonstrate setting it up with Laravel.
Here’s the default PHPUnit experience when you have an exception during a test. You might notice that the first place you want to look is the top of the exception stack, so you have to scroll up to see it:
To get a much better experience, add the Collision listener to your Laravel project’s
<listeners> <listener class="NunoMaduro\Collision\Adapters\Phpunit\Listener" /> </listeners>
Now you get a nice clean view of where the exception occurred after the full stack trace:
Boom! Collision provides a much better experience while running PHPUnit tests via the command line!
To learn more about this package, check it out on GitHub at nunomaduro/collision.Filed in: News
Join 31,000+ others and never miss out on new tips, tutorials, and more.