Test Failed
Pull Request — master (#132)
by Alessandro
03:15
created

otherStatusesProvider()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12

Duplication

Lines 12
Ratio 100 %

Importance

Changes 0
Metric Value
dl 12
loc 12
rs 9.8666
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Tests\Functional\Parser\JSON;
6
7
use Paraunit\Parser\JSON\AbnormalTerminatedParser;
8
use Paraunit\Parser\JSON\LogFetcher;
9
use Paraunit\TestResult\TestResultWithAbnormalTermination;
10
use Tests\BaseFunctionalTestCase;
11
use Tests\Stub\StubbedParaunitProcess;
12
13
/**
14
 * Class AbnormalTerminatedParserTest
15
 * @package Functional\Parser
16
 */
17
class AbnormalTerminatedParserTest extends BaseFunctionalTestCase
18
{
19 View Code Duplication
    public function testHandleLogItemWithAbnormalTermination()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
20
    {
21
        $process = new StubbedParaunitProcess();
22
        $log = new \stdClass();
23
        $log->status = LogFetcher::LOG_ENDING_STATUS;
24
        $log->test = 'testFunction()';
25
        /** @var AbnormalTerminatedParser $parser */
26
        $parser = $this->getService(AbnormalTerminatedParser::class);
27
28
        $parsedResult = $parser->handleLogItem($process, $log);
29
30
        $this->assertInstanceOf(TestResultWithAbnormalTermination::class, $parsedResult);
31
    }
32
33
    /**
34
     * @dataProvider otherStatusesProvider
35
     */
36
    public function testHandleLogItemWithUncatchedLog($otherStatuses)
37
    {
38
        $process = new StubbedParaunitProcess();
39
        $log = new \stdClass();
40
        $log->status = $otherStatuses;
41
        /** @var AbnormalTerminatedParser $parser */
42
        $parser = $this->getService(AbnormalTerminatedParser::class);
43
44
        $parsedResult = $parser->handleLogItem($process, $log);
45
46
        $this->assertNull($parsedResult);
47
        $this->assertFalse($process->hasAbnormalTermination());
48
    }
49
50
    /**
51
     * @return string[][]
52
     */
53 View Code Duplication
    public function otherStatusesProvider(): array
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
54
    {
55
        return [
56
            ['error'],
57
            ['fail'],
58
            ['pass'],
59
            ['testStart'],
60
            ['suiteStart'],
61
            ['qwerty'],
62
            ['trollingYou'],
63
        ];
64
    }
65
}
66