Last active
January 4, 2017 16:04
-
-
Save jsifalda/4442254 to your computer and use it in GitHub Desktop.
Run phpUnit tests before commit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# An example hook script to verify what is about to be committed. | |
# Called by "git commit" with no arguments. The hook should | |
# exit with non-zero status after issuing an appropriate message if | |
# it wants to stop the commit. | |
echo "[PRECOMMIT HOOK] Running tests" | |
if [[ -e "libs/bin/phpunit" ]]; then | |
if [[ -d "tests" ]]; then | |
cd tests | |
../libs/bin/phpunit . | |
# phpunit . #if you have got a global phpunit | |
echo "\n" | |
else | |
echo "Folder './tests' does not exist" | |
fi | |
else | |
echo "libs/bin/phpunit does not exist" | |
fi | |
# Global setting - for all repositories | |
# git config --global init.templatedir '~/.git_template' | |
# Afterward, new repositories you create or clone will use this directory for templates. | |
# Place the hooks you want in ~/.git_template/hooks. Existing repositories can be reinitialized with the proper templates by running git init in the same directory .git is in. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment