Skip to content

Instantly share code, notes, and snippets.

@jasdeepkhalsa
Forked from raphaelstolt/pre-commit
Last active December 19, 2015 07:09
Show Gist options
  • Select an option

  • Save jasdeepkhalsa/5916811 to your computer and use it in GitHub Desktop.

Select an option

Save jasdeepkhalsa/5916811 to your computer and use it in GitHub Desktop.
Pre-commit hook for SVN and PHPUnit
#!/usr/bin/php
<?php
$projectName = basename(getcwd());
exec('phpunit', $output, $returnCode); // Assuming cwd here
if ($returnCode !== 0) {
$minimalTestSummary = array_pop($output);
printf("Test suite for %s failed: ", $projectName);
printf("( %s ) %s%2\$s", $minimalTestSummary, PHP_EOL);
return false; // exit(1);
}
printf("All tests for %s passed.%s%2\$s", $projectName, PHP_EOL);
return true; // exit(0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment