Skip to content

Commit c4e4910

Browse files
Merge pull request #76 from edmondscommerce/DeEmphasiseSkippedTests
De emphasise skipped tests
2 parents 004540b + 3cc59cf commit c4e4910

File tree

2 files changed

+31
-8
lines changed

2 files changed

+31
-8
lines changed

includes/generic/phpunit.inc.bash

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,13 @@ do
3939
# No Coverage mode - do not generate coverage, do enforce time limits
4040
extraConfigs+=( --no-coverage )
4141
extraConfigs+=( --enforce-time-limit )
42-
else
43-
# Coverage generation mode (slow) - stop on first error, do not enforce time limits
42+
elif [[ "false" != "${CI:-'false'}" ]]
43+
then
44+
# When in CI and generating coverage - stop on first error, do not enforce time limits
4445
extraConfigs+=( --stop-on-failure --stop-on-error --stop-on-defect --stop-on-warning )
46+
else
47+
# Default mode - do generate coverage if configured to do so, do enforce time limits
48+
extraConfigs+=( --enforce-time-limit )
4549
fi
4650
set +e
4751
set -x

src/PHPUnit/TestDox/CliTestDoxPrinter.php

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,19 @@
2626
*/
2727
class CliTestDoxPrinter extends ResultPrinter
2828
{
29+
private const SYMBOL_SKIP = '';
2930
/**
3031
* @var \EdmondsCommerce\PHPQA\PHPUnit\TestDox\TestResult
3132
*/
3233
private $currentTestResult;
33-
3434
/**
3535
* @var \EdmondsCommerce\PHPQA\PHPUnit\TestDox\TestResult
3636
*/
3737
private $previousTestResult;
38-
3938
/**
4039
* @var \EdmondsCommerce\PHPQA\PHPUnit\TestDox\TestResult[]
4140
*/
4241
private $nonSuccessfulTestResults = [];
43-
4442
/**
4543
* @var NamePrettifier
4644
*/
@@ -179,12 +177,13 @@ public function addRiskyTest(Test $test, \Throwable $t, float $time): void
179177
public function addSkippedTest(Test $test, \Throwable $t, float $time): void
180178
{
181179
$this->currentTestResult->fail(
182-
$this->formatWithColor('fg-yellow', ''),
180+
$this->formatWithColor('fg-yellow', self::SYMBOL_SKIP),
183181
(string)$t,
184182
true
185183
);
186184
}
187185

186+
188187
public function writeProgress(string $progress): void
189188
{
190189
}
@@ -219,14 +218,34 @@ private function printNonSuccessfulTestsSummary(int $numberOfExecutedTests): voi
219218
return;
220219
}
221220

222-
$this->write("Summary of non-successful tests:\n\n");
221+
$this->write(
222+
$this->formatWithColor(
223+
'fg-yellow',
224+
"Summary of non-successful tests:"
225+
)
226+
. "\n\n"
227+
);
223228

224229
$previousTestResult = null;
225230

231+
$skippedTests = 0;
226232
foreach ($this->nonSuccessfulTestResults as $testResult) {
227-
$this->write($testResult->toString($previousTestResult, $this->verbose));
233+
$line = $testResult->toString($previousTestResult, $this->verbose);
234+
if (false !== \strpos($line, self::SYMBOL_SKIP)) {
235+
$skippedTests++;
236+
continue;
237+
}
238+
$this->write($line);
228239

229240
$previousTestResult = $testResult;
230241
}
242+
if ($skippedTests > 0) {
243+
$this->write(
244+
$this->formatWithColor(
245+
'fg-yellow',
246+
"\n" . self::SYMBOL_SKIP . ' Skipped Tests: ' . $skippedTests . "\n\n"
247+
)
248+
);
249+
}
231250
}
232251
}

0 commit comments

Comments
 (0)