Heads up: This post is over two years old. Things move fast — the code, tools, or opinions here may be outdated.

Realtime PHPUnit

← PreviousSymfony2 app/console bash completion
Next →Email Subaddressing

Not all IDEs (actually, i haven’t seen even one IDE that does this), can run your unit-tests as soon as something changes.

Inspired by Greg Young’s Mighty Moose system, the following script runs inside a shell, will wait for changes in your PHP-files, and runs the corresponding unit-test as soon as something changes. It doesn’t run the WHOLE unit-tests suite, but merely the test that matches up the source file.

This script will assume that your test-directory matches the directory-structure of your source directories. Meaning: /src/foo/bar/baz.php will have its corresponding tests inside the file /tests/foo/bar/bazTest.php, which is common practice for your tests anyway.

Fork && have fun!

https://github.com/jaytaph/RealTimePHPUnit

← PreviousSymfony2 app/console bash completion
Next →Email Subaddressing