|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Tests\Functional\Printer; |
|
6
|
|
|
|
|
7
|
|
|
use Paraunit\Printer\ConsoleFormatter; |
|
8
|
|
|
use Paraunit\TestResult\TestResultContainer; |
|
9
|
|
|
use Symfony\Component\Console\Formatter\OutputFormatterStyleInterface; |
|
10
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
|
11
|
|
|
use Tests\BaseFunctionalTestCase; |
|
12
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* Class ConsoleFormatterTest |
|
15
|
|
|
* @package Tests\Functional\Printer |
|
16
|
|
|
*/ |
|
17
|
|
|
class ConsoleFormatterTest extends BaseFunctionalTestCase |
|
18
|
|
|
{ |
|
19
|
|
|
/** |
|
20
|
|
|
* @dataProvider serviceTagsProvider |
|
21
|
|
|
*/ |
|
22
|
|
|
public function testOnEngineStartHasAllTagsRegistered(string $containerServiceName) |
|
23
|
|
|
{ |
|
24
|
|
|
/** @var TestResultContainer $testResultContainer */ |
|
25
|
|
|
$testResultContainer = $this->getService($containerServiceName); |
|
26
|
|
|
/** @var ConsoleFormatter $consoleFormatter */ |
|
27
|
|
|
$consoleFormatter = $this->getService(ConsoleFormatter::class); |
|
28
|
|
|
/** @var OutputInterface $outputInterface */ |
|
29
|
|
|
$outputInterface = $this->getService(OutputInterface::class); |
|
30
|
|
|
|
|
31
|
|
|
$consoleFormatter->onEngineBeforeStart(); |
|
32
|
|
|
|
|
33
|
|
|
$tag = $testResultContainer->getTestResultFormat()->getTag(); |
|
34
|
|
|
$formatter = $outputInterface->getFormatter(); |
|
35
|
|
|
$style = $formatter->getStyle($tag); |
|
36
|
|
|
$this->assertInstanceOf( |
|
37
|
|
|
OutputFormatterStyleInterface::class, |
|
38
|
|
|
$style, |
|
39
|
|
|
'Missing tag style: ' . $tag . ' -- service ' . $containerServiceName |
|
40
|
|
|
); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* @return string[][] |
|
45
|
|
|
*/ |
|
46
|
|
|
public function serviceTagsProvider(): array |
|
47
|
|
|
{ |
|
48
|
|
|
return [ |
|
49
|
|
|
['paraunit.test_result.abnormal_terminated_container'], |
|
50
|
|
|
['paraunit.test_result.error_container'], |
|
51
|
|
|
['paraunit.test_result.failure_container'], |
|
52
|
|
|
['paraunit.test_result.warning_container'], |
|
53
|
|
|
['paraunit.test_result.risky_container'], |
|
54
|
|
|
['paraunit.test_result.skipped_container'], |
|
55
|
|
|
['paraunit.test_result.incomplete_container'], |
|
56
|
|
|
]; |
|
57
|
|
|
} |
|
58
|
|
|
} |
|
59
|
|
|
|