Last active
May 16, 2023 12:37
-
-
Save barryvdh/3691cbad662ce26ffcad7d3807e89d69 to your computer and use it in GitHub Desktop.
phpunit pre-commit git hook
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 "Aborting commit.." . PHP_EOL; | |
exit(1); | |
} | |
// Show summary (last line) | |
echo array_pop($output) . PHP_EOL; | |
exit(0); |
Thank you!
Love this....
Great!
For PHP ^8.0:
implode(string $separator, array $array): string
Legacy signature (deprecated as of PHP 7.4.0, removed as of PHP 8.0.0):
implode(array $array, string $separator): string
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Barry hooks you up!