Passed
Branch master (cd2b9b)
by Scott
03:31
created

testCorrectMissingFile()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

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