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

testHandleLogItemShouldCatchAnything()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 17
rs 9.7
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Tests\Unit\Parser\JSON;
6
7
use Paraunit\Parser\JSON\UnknownResultParser;
8
use Paraunit\TestResult\Interfaces\TestResultHandlerInterface;
9
use Paraunit\TestResult\TestResultFactory;
10
use Prophecy\Argument;
11
use Tests\BaseUnitTestCase;
12
use Tests\Stub\StubbedParaunitProcess;
13
14
/**
15
 * Class UnknownResultParserTest
16
 * @package Tests\Unit\Parser\JSON
17
 */
18
class UnknownResultParserTest extends BaseUnitTestCase
19
{
20
    /**
21
     * @dataProvider statusesProvider
22
     */
23
    public function testHandleLogItemShouldCatchAnything(string $statuses)
24
    {
25
        $log = new \stdClass();
26
        $log->status = $statuses;
27
        $log->message = 'message';
28
29
        $factory = $this->prophesize(TestResultFactory::class);
30
        $factory->createFromLog($log)
31
            ->shouldBeCalled()
32
            ->willReturn($this->mockPrintableTestResult());
33
        $resultContainer = $this->prophesize(TestResultHandlerInterface::class);
34
        $resultContainer->handleTestResult(Argument::cetera())
35
            ->shouldBeCalled();
36
37
        $parser = new UnknownResultParser($factory->reveal(), $resultContainer->reveal(), 'no-status-required');
38
        $this->assertNotNull($parser->handleLogItem(new StubbedParaunitProcess(), $log));
39
    }
40
41 View Code Duplication
    public function statusesProvider(): 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...
42
    {
43
        return [
44
            ['pass'],
45
            ['error'],
46
            ['fail'],
47
            ['pass'],
48
            ['testStart'],
49
            ['suiteStart'],
50
            ['qwerty'],
51
            ['trollingYou'],
52
        ];
53
    }
54
}
55