I\'d like to run my PHPUnit tests (or at least a subset of them) whenever a file changes on disk. Very similar to what you can do with \"grunt watch\". I have a project in which
Maybe you can try phpunit-watcher
. https://packagist.org/packages/spatie/phpunit-watcher
First, to install phpunit-watcher
with composer require spatie/phpunit-watcher --dev
, and then, modify the composer.json
to add an item in scripts
property:
{
"scripts" : {
"test" : "./vendor/bin/phpunit-watcher watch --bootstrap vendor/autoload.php tests/"
}
}
Then, you can run test cases with: composer test
.
Sometimes, you should run composer run test --timeout=0
, otherwise the process would be killed after 300 seconds.