Skip to content

Instantly share code, notes, and snippets.

@jesseadams
Created November 12, 2011 05:26
Show Gist options
  • Save jesseadams/1360090 to your computer and use it in GitHub Desktop.
Save jesseadams/1360090 to your computer and use it in GitHub Desktop.
Automatically execute phpunit
#!/bin/bash
#
# Automatically run phpunit when you save a test
#
# Requires: inotify-tools
#
###################
path=$1
orig_dir=`pwd`
if [ -z $path ]; then
if [ -f "phpunit.xml" ]; then
path=`pwd`
else
echo "Please specify the path to your phpunit.xml"
exit 2
fi
fi
while [ 1 ]; do
echo "Watching $path..."
inotifywait -qqr $path --exclude 'swp$' --event modify
cd $path
phpunit $path
cd $orig_dir
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment