forked from mheap/phpunit-github-actions-printer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPrinter8.php
49 lines (38 loc) · 1.19 KB
/
Printer8.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
namespace mheap\GithubActionsReporter;
use PHPUnit\Framework\TestFailure;
use PHPUnit\Framework\TestResult;
use PHPUnit\TextUI\ResultPrinter;
use function mheap\GithubActionsReporter\Functions\getCurrentType;
use function mheap\GithubActionsReporter\Functions\printDefects;
use function mheap\GithubActionsReporter\Functions\printDefectTrace;
class Printer8 extends ResultPrinter
{
/**
* @var null|string
*/
private $currentType;
protected function printHeader(TestResult $result = null): void
{
}
protected function writeProgress(string $progress): void
{
}
protected function printFooter(TestResult $result): void
{
}
protected function printDefects(array $defects, string $type): void
{
$this->currentType = (in_array($type, ['error', 'failure']) === true) ? 'error' : 'warning';
foreach ($defects as $i => $defect) {
$this->printDefect($defect, $i);
}
}
protected function printDefectHeader(TestFailure $defect, int $count): void
{
}
protected function printDefectTrace(TestFailure $defect): void
{
$this->write(printDefectTrace($defect, $this->currentType));
}
}