Skip to content

Instantly share code, notes, and snippets.

@michaelcontento
Created June 9, 2011 10:19
Show Gist options
  • Save michaelcontento/1016479 to your computer and use it in GitHub Desktop.
Save michaelcontento/1016479 to your computer and use it in GitHub Desktop.
Simple combination of inotifywait and phpunit
#!/bin/sh
if [ $# -ne 1 ]; then
echo "usage: $0 TEST-DIR"
exit 1
fi
testsDir=$1
if [ ! -d $testsDir ]; then
echo "error: invalid dir $testsDir"
exit 1
fi
cd $testsDir
echo "info: waiting for the first change ..."
inotifywait -m -r -q -e move --format %w%f . \
| while read FILE; do
echo $FILE | grep -v 'Test.php$' && continue
clear
echo "info: change detected in $FILE ..."
phpunit --coverage-html ../build/coverage/ $FILE
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment