-
-
Save odixon/4f509814b3d62eb7c416cd39fab43f1f to your computer and use it in GitHub Desktop.
Git pre-push hook for PHPUnit
This file contains 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
#!/usr/bin/env php | |
<?php | |
echo "Running tests.. "; | |
exec('vendor/bin/phpunit', $output, $returnCode); | |
if ($returnCode !== 0) { | |
// Show full output | |
echo PHP_EOL . implode($output, PHP_EOL) . PHP_EOL; | |
echo "Cannot push changes untill tests are OK.." . PHP_EOL; | |
exit(1); | |
} | |
// Show summary (last line) | |
echo array_pop($output) . PHP_EOL; | |
exit(0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment