Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit cf2e123

Browse files
committed
add git-hooks for codeception tests and dev libraries mockery and IDE helper (like PhpStorm)
1 parent e672074 commit cf2e123

File tree

2 files changed

+10
-18
lines changed

2 files changed

+10
-18
lines changed

‎git-hooks/pre-commit‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,14 @@ $projectName = basename(getcwd());
66
exec('vendor\bin\codecept run --no-colors -n --html', $output, $returnCode);
77

88
if ($returnCode !== 0) {
9+
//We will fetch the generated HTML page with all test results and print it to the message
910
$html = array_pop($output);
10-
$minimalTestSummary = array_pop($output);
11-
printf("Codeception Test suite for %s failed: ", $projectName);
12-
printf("( %s ) %s", $minimalTestSummary, PHP_EOL);
13-
printf("%s %s", $html, PHP_EOL);
14-
printf("ABORTING Push!\n");
15-
exit(1);
16-
} else {
17-
printf("Codeception tests are successful!\n");
11+
$minimalTestSummary = array_pop($output);
12+
printf("Codeception Test suite for %s failed: ", $projectName);
13+
printf("( %s ) %s", $minimalTestSummary, PHP_EOL);
14+
printf("%s %s", $html, PHP_EOL);
15+
printf("ABORTING Push!\n");
16+
exit(1);
1817
}
1918

2019
exit(0);

‎git-hooks/pre-push‎

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,11 @@
33

44
$projectName = basename(getcwd());
55

6-
exec('vendor\bin\codecept run --no-colors -n --html', $output, $returnCode);
6+
exec('vendor\bin\codecept run -q -n', $output, $returnCode);
77

88
if ($returnCode !== 0) {
9-
$html = array_pop($output);
10-
$minimalTestSummary = array_pop($output);
11-
printf("Codeception Test suite for %s failed: ", $projectName);
12-
printf("( %s ) %s", $minimalTestSummary, PHP_EOL);
13-
printf("%s %s", $html, PHP_EOL);
14-
printf("ABORTING Push!\n");
15-
exit(1);
16-
} else {
17-
printf("Codeception tests are successful!\n");
9+
printf("ABORTING Push!\n");
10+
exit(1);
1811
}
1912

2013
exit(0);

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /