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

Nice new package by Freek from Spatie.be. 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

Published by Bramus!

Bramus is a frontend web developer from Belgium, working as a Chrome Developer Relations Engineer at Google. From the moment he discovered view-source at the age of 14 (way back in 1997), he fell in love with the web and has been tinkering with it ever since (more …)

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.