Issues (37)

tests/Loaders/PhanTextTest.php (1 issue)

Labels
Severity
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
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