PhanTextTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 31
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testOutput() 0 15 1
A testNotFoundFile() 0 3 1
A setUp() 0 4 1
1
<?php
2
namespace exussum12\CoverageChecker\tests\Loaders;
3
4
use PHPUnit\Framework\TestCase;
5
use exussum12\CoverageChecker\Loaders\PhanText;
6
7
class PhanTextTest extends TestCase
8
{
9
    /** @var  PhanText */
10
    protected $phan;
11
    protected function setUp()
12
    {
13
        parent::setUp();
14
        $this->phan = new PhanText(__DIR__ . '/../fixtures/phan.txt');
15
    }
16
17
    public function testOutput()
18
    {
19
        $file1 = 'src/ArgParser.php';
20
21
        $lines = $this->phan->parseLines();
22
23
        $this->assertCount(2, $lines);
24
25
        $this->assertContains(
26
            'Argument 1 (string) is int but \strlen() takes string',
27
            current($this->phan->getErrorsOnLine($file1, 35))
0 ignored issues
show
Bug introduced by
It seems like $this->phan->getErrorsOnLine($file1, 35) can also be of type null; however, parameter $array of current() does only seem to accept array, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

27
            current(/** @scrutinizer ignore-type */ $this->phan->getErrorsOnLine($file1, 35))
Loading history...
28
        );
29
        $this->assertEquals(
30
            [],
31
            $this->phan->getErrorsOnLine($file1, 30)
32
        );
33
    }
34
35
    public function testNotFoundFile()
36
    {
37
        $this->assertTrue($this->phan->handleNotFoundFile());
38
    }
39
}
40