HumbugLoaderTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 14
dl 0
loc 30
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testHandleFileNotFound() 0 4 1
A testBadFormat() 0 4 1
A testCanMakeClass() 0 15 1
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