PhpStanTest::testGetOutput()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 8
rs 10
c 0
b 0
f 0
1
<?php
2
namespace exussum12\CoverageChecker\tests;
3
4
use PHPUnit\Framework\TestCase;
5
use exussum12\CoverageChecker\Loaders\PhpStan;
6
7
class PhpStanTest extends TestCase
8
{
9
    /** @var  PhpStan */
10
    protected $stan;
11
12
    public function setUp()
13
    {
14
        $file = __DIR__ . '/../fixtures/phpstan.txt';
15
        $this->stan = new PhpStan($file);
16
    }
17
18
    public function testGetOutput()
19
    {
20
        $expected = [
21
            'src/PhpStanLoader.php',
22
            'src/PhpCsLoader.php',
23
        ];
24
25
        $this->assertSame($expected, $this->stan->parseLines());
26
    }
27
28
    public function testInvalidLine()
29
    {
30
        $this->stan->parseLines();
31
        $this->assertEquals(
32
            ['Access to an undefined property exussum12\CoverageChecker\PhpStanLoader::$invalidLines.'],
33
            $this->stan->getErrorsOnLine("src/PhpStanLoader.php", 45)
34
        );
35
    }
36
37
    public function testValidLine()
38
    {
39
        $this->stan->parseLines();
40
        $this->assertEquals(
41
            [],
42
            $this->stan->getErrorsOnLine("src/PhpStanLoader.php", 41)
43
        );
44
    }
45
46
    public function testNotFoundFile()
47
    {
48
        $this->assertTrue($this->stan->handleNotFoundFile());
49
    }
50
}
51