Skip to content

Instantly share code, notes, and snippets.

@fiunchinho
Last active December 25, 2015 10:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fiunchinho/6960921 to your computer and use it in GitHub Desktop.
Save fiunchinho/6960921 to your computer and use it in GitHub Desktop.
Watch for changes in files (code and tests) and run phpunit tests whenever changes are detected. Althought is not needed, I recommend to use a phpunit.xml configuration file.
#!/bin/bash
if [ $# -ne 1 ]; then
echo "Usage: $0 CODE-DIRECTORY"
exit 1
fi
code_directory=$1
if [ ! -d $code_directory ]; then
echo "Error: invalid dir $code_directory"
exit 1
fi
while inotifywait -qq -e close_write -r $code_directory --exclude=".*sw[px]"; do
clear && phpunit $code_directory
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment