Run PHPUnit tests every time a file changes

Running unit tests manually sucks and is a waste of time. What if you could automatically run your tests every time a file changes? Well, you can! :P

A simple bash script that uses inofity-tools can detect changes in the filesystem and run all the commands you need. In this case, I wanted to run my tests when anything changed in the /test folder, clear the screen and display the PHPUnit results - below follows the resulting script:

while true; do
  inotifywait -r ./test -e modify,close_write,moved_to,move,create,delete &&
  clear &&
  phpunit --configuration phpunit.xml
done

I used to have Disqus enabled on my website, but I have disabled it because of privacy concerns.

If you feel like commenting or asking something, you can still contact me via other means.