mirror of
https://tildegit.org/sbgodin/HtmGem.git
synced 2023-08-25 13:53:12 +02:00
28 lines
505 B
PHP
28 lines
505 B
PHP
#!/usr/bin/env php
|
|
<?php
|
|
|
|
/**
|
|
* This file is to be placed in ./.git/hooks
|
|
* and set as executable.
|
|
*
|
|
* It will perform tests before any commit.
|
|
* To override: git commit -n
|
|
*/
|
|
|
|
echo "Running tests…";
|
|
exec('phpunit tests', $output, $returnCode);
|
|
|
|
// Removes the first line
|
|
array_shift($output);
|
|
|
|
if ($returnCode !== 0) {
|
|
echo PHP_EOL . implode($output, PHP_EOL) . PHP_EOL;
|
|
echo "Tests failed…" . PHP_EOL;
|
|
exit(1);
|
|
}
|
|
|
|
// Show summary (last line)
|
|
echo array_pop($output) . PHP_EOL;
|
|
|
|
exit(0);
|