Skip to content

Instantly share code, notes, and snippets.

@johndrinkwater
Created January 28, 2015 13:59
Show Gist options
  • Save johndrinkwater/cd96810e3b277b7e2fb1 to your computer and use it in GitHub Desktop.
Save johndrinkwater/cd96810e3b277b7e2fb1 to your computer and use it in GitHub Desktop.
This pre-commit hook should be placed in the file $repo/.git/hooks/pre-commit
#!/usr/bin/env php
<?php
exec("phpunit --configuration .phpunit.xml", $output, $returnCode );
if ( $returnCode !== 0 ) {
$summary = array_pop( $output );
printf( "Stop `git commit`, test failed with: ( %s )\n", $summary );
exit( 1 );
}
exit( 0 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment