Realtime PHPUnit
Warning:
This blogpost has been posted over two years ago. That is a long time in development-world! The story here may
not be relevant, complete or secure. Code might not be complete or obsoleted, and even my current vision might
have (completely) changed on the subject. So please do read further, but use it with caution.
Posted on 02 Feb 2014Tagged with: [ continuous tests ] [ phpunit ]
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