|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Tests\Functional\Printer; |
|
6
|
|
|
|
|
7
|
|
|
use Paraunit\Printer\FilesRecapPrinter; |
|
8
|
|
|
use Paraunit\Process\AbstractParaunitProcess; |
|
9
|
|
|
use Paraunit\TestResult\TestResultContainer; |
|
10
|
|
|
use Tests\BaseFunctionalTestCase; |
|
11
|
|
|
use Tests\Stub\StubbedParaunitProcess; |
|
12
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* Class FilesRecapPrinterTest |
|
15
|
|
|
* @package Tests\Functional\Printer |
|
16
|
|
|
*/ |
|
17
|
|
|
class FilesRecapPrinterTest extends BaseFunctionalTestCase |
|
18
|
|
|
{ |
|
19
|
|
|
public function testOnEngineEndPrintsInTheRightOrder() |
|
20
|
|
|
{ |
|
21
|
|
|
$process = new StubbedParaunitProcess(); |
|
22
|
|
|
|
|
23
|
|
|
$this->processAllTheStubLogs(); |
|
24
|
|
|
$this->addProcessToContainers($process); |
|
25
|
|
|
|
|
26
|
|
|
/** @var FilesRecapPrinter $printer */ |
|
27
|
|
|
$printer = $this->getService(FilesRecapPrinter::class); |
|
28
|
|
|
|
|
29
|
|
|
$printer->onEngineEnd(); |
|
30
|
|
|
|
|
31
|
|
|
$output = $this->getConsoleOutput(); |
|
32
|
|
|
|
|
33
|
|
|
$this->assertNotEmpty($output->getOutput()); |
|
34
|
|
|
$this->assertNotContains('PASSED output', $output->getOutput(), '', true); |
|
35
|
|
|
$this->assertNotContains('SKIPPED output', $output->getOutput(), '', true); |
|
36
|
|
|
$this->assertNotContains('INCOMPLETE output', $output->getOutput(), '', true); |
|
37
|
|
|
$this->assertNotContains('files with PASSED', $output->getOutput(), '', true); |
|
38
|
|
|
$this->assertOutputOrder($output, [ |
|
39
|
|
|
'files with UNKNOWN', |
|
40
|
|
|
'files with COVERAGE NOT FETCHED', |
|
41
|
|
|
'files with ERRORS', |
|
42
|
|
|
'files with FAILURES', |
|
43
|
|
|
'files with WARNING', |
|
44
|
|
|
'files with NO TESTS EXECUTED', |
|
45
|
|
|
'files with RISKY', |
|
46
|
|
|
'files with SKIP', |
|
47
|
|
|
'files with INCOMPLETE', |
|
48
|
|
|
]); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
private function addProcessToContainers(AbstractParaunitProcess $process) |
|
52
|
|
|
{ |
|
53
|
|
|
/** @var TestResultContainer $noTestExecuted */ |
|
54
|
|
|
$noTestExecuted = $this->getService('paraunit.test_result.no_test_executed_container'); |
|
55
|
|
|
$noTestExecuted->addProcessToFilenames($process); |
|
56
|
|
|
|
|
57
|
|
|
/** @var TestResultContainer $coverageFailure */ |
|
58
|
|
|
$coverageFailure = $this->getService('paraunit.test_result.coverage_failure_container'); |
|
59
|
|
|
$coverageFailure->addProcessToFilenames($process); |
|
60
|
|
|
} |
|
61
|
|
|
} |
|
62
|
|
|
|