HumbugLoaderTest::testHandleFileNotFound()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
namespace exussum12\CoverageChecker\tests\Loaders;
3
4
use InvalidArgumentException;
5
use PHPUnit\Framework\TestCase;
6
use exussum12\CoverageChecker\Loaders\Humbug;
7
8
class HumbugLoaderTest extends TestCase
9
{
10
    public function testCanMakeClass()
11
    {
12
        $humbug = new Humbug(__DIR__ . '/../fixtures/humbug.json');
13
        $invalidFiles = $humbug->parseLines();
14
15
        $this->assertEquals(1, count($invalidFiles));
16
        $file = 'src/DiffLineHandle/OldVersion/DiffStart.php';
17
18
        $this->assertContains(
19
            'Failed on escaped check',
20
            current($humbug->getErrorsOnLine($file, 23))
21
        );
22
        $this->assertEquals(
23
            [],
24
            $humbug->getErrorsOnLine($file, 22)
25
        );
26
    }
27
28
    public function testHandleFileNotFound()
29
    {
30
        $humbug = new Humbug(__DIR__ . '/../fixtures/humbug.json');
31
        $this->assertTrue($humbug->handleNotFoundFile());
32
    }
33
34
    public function testBadFormat()
35
    {
36
        $this->expectException(InvalidArgumentException::class);
37
        new Humbug(__DIR__ . '/../fixtures/change.txt');
38
    }
39
}
40