Automatically Running PHPUnit Tests with Laravel Elixir

Elixir Testing

Committed to the LaraBrain by: wjgilmore (@wjgilmore) at October 23, 2015 1:37 pm

Save yourself the hassle of constantly returning to the terminal when writing PHPUnit tests

Laravel's test-related features are amazingly user friendly (you'll find several examples in the LaraBrain source code), insomuch that not taking advantage of the convenience syntax on your next Laravel project would be a crime.

When writing tests it can be a drag to constantly return to the terminal and execute the phpunit command. Fortunately, you can take advantage of another Laravel feature to automatically run the tests for you every time you save project file changes! Just add the following line to your gulpfile.js file:


Then open a new terminal tab and run the following command from your project root directory:

$ gulp tdd

Once executed, Elixir will begin monitoring for changes, and run your test suite automatically!