Automatically rerun PHPUnit tests when source code changes with phpunit-watcher

Nice new package by Freek from Think of it like Jest, but for PHP:

Wouldn’t it be great if your PHPUnit tests would be automatically rerun whenever you change some code? This package can do exactly that.

By default it will watch all files in the src, app and tests subdirectories in the directory where it is started.

Installation per Composer, of course:

composer global require spatie/phpunit-watcher

spatie/phpunit-watcher introductory blogpost →
spatie/phpunit-watcher (GitHub) →

Sidenote: If you’re new to PHPUnit, Sitepoint has got you covered with a newly released (re-)introduction to PHPUnit. Also, the folks over at CxSocial (former Engagor) have written a nice post on how to write better tests in PHPUnit

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.