Collision PHPUnit Listener With Laravel

Collision PHPUnit Listener With Laravel

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:

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 printer class to your Laravel project’s phpunit.xml file:

<phpunit xmlns:xsi=""
<!-- ... -->

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
Laravel News Partners

Laravel Jobs

Senior Full Stack Engineer - Laravel
Laravel partner seeks Lead Developer
Kirschbaum Development Group
Senior Programmer **Immediate Opening** (send resume to
SBG Corp
Web Developer - Laravel
Grand Forks, North Dakota
Center for Rural Health
Senior Full-Stack Laravel Developer
Berlin, Germany


Join 31,000+ others and never miss out on new tips, tutorials, and more.