LoadPhpMdReportStrictTest::testClassCanLoad()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 28
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 17
nc 1
nop 0
dl 0
loc 28
rs 9.7
c 0
b 0
f 0
1
<?php
2
namespace exussum12\CoverageChecker\tests\Loaders;
3
4
use PHPUnit\Framework\TestCase;
5
use exussum12\CoverageChecker\Loaders\PhpMdStrict;
6
7
class LoadPhpMdReportStrictTest extends TestCase
8
{
9
    public function testClassCanLoad()
10
    {
11
        $phpmd = new PhpMdStrict(__DIR__ . '/../fixtures/phpmd.xml');
12
        $lines = $phpmd->parseLines();
13
        $file = '/full/path/to/file/src/CoverageCheck.php';
14
        $expected = [$file];
15
16
        $this->assertEquals($expected, $lines);
17
18
        $expectedError = [
19
            'The method addUnCoveredLine has a boolean flag argument ' .
20
            '$message, which is a certain sign of a ' .
21
            'Single Responsibility Principle violation.'
22
        ];
23
24
        $this->assertEquals(
25
            $expectedError,
26
            $phpmd->getErrorsOnLine($file, 57)
27
        );
28
29
        $this->assertEquals(
30
            $expectedError,
31
            $phpmd->getErrorsOnLine($file, 58)
32
        );
33
34
        $this->assertEquals(
35
            [],
36
            $phpmd->getErrorsOnLine($file, 10)
37
        );
38
    }
39
40
    public function testCorrectMissingFile()
41
    {
42
        $phpmd = new PhpMdStrict(__DIR__ . '/../fixtures/phpmd.xml');
43
44
        $this->assertTrue($phpmd->handleNotFoundFile());
45
    }
46
}
47