Skip to content

Instantly share code, notes, and snippets.

@lazyguru
Created December 24, 2016 04:36
Show Gist options
  • Save lazyguru/10208fc8f1b7e6cdeaf5d03a6f06782c to your computer and use it in GitHub Desktop.
Save lazyguru/10208fc8f1b7e6cdeaf5d03a6f06782c to your computer and use it in GitHub Desktop.
Always run the correct version of phpunit for each project. Add this to ~/bin/phpunit and ensure ~/bin is at the beginning of your PATH
#!/usr/bin/env bash
if [ -f vendor/bin/phpunit ]; then
vendor/bin/phpunit $@
exit $?
fi
if [ -f ~/.composer/vendor/bin/phpunit ]; then
~/.composer/vendor/bin/phpunit $@
exit $?
fi
if [ -f /usr/local/bin/phpunit ]; then
/usr/local/bin/phpunit $@
exit $?
fi
echo "I'm out of ideas. Can't find phpunit anywhere. Maybe you should 'composer global require phpunit/phpunit'"
exit 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment