Passed
Pull Request — master (#26)
by Scott
02:11
created

LoadCloverReportTest::testLoadXML()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 22
Code Lines 13

Duplication

Lines 22
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 13
nc 1
nop 0
dl 22
loc 22
rs 9.2
c 1
b 0
f 0
1
<?php
2
namespace exussum12\CoverageChecker\tests;
3
4
use PHPUnit\Framework\TestCase;
5
6
use exussum12\CoverageChecker\CloverLoader;
7
8
class LoadCloverReportTest extends TestCase
9
{
10 View Code Duplication
    public function testLoadXML()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
11
    {
12
        $xmlReport = new CloverLoader(__DIR__ . '/fixtures/coverage.xml');
13
        $coveredLines = $xmlReport->parseLines();
14
        $expected = [
15
            '/path/to/file/changedFile.php',
16
            '/path/to/file/otherFile.php',
17
        ];
18
        $this->assertEquals($expected, $coveredLines);
19
20
        $this->assertEquals(
21
            ['No unit test covering this line'],
22
            $xmlReport->getErrorsOnLine('/path/to/file/changedFile.php', 14)
23
        );
24
25
        $this->assertEquals(
26
            [],
27
            $xmlReport->getErrorsOnLine('/path/to/file/changedFile.php', 10)
28
        );
29
        //True as the report doesnt contain the file
30
        $this->assertNull($xmlReport->getErrorsOnLine('/path/to/file/NonExistantFile.php', 6));
31
    }
32
33
    public function testCorrectMissingFile()
34
    {
35
        $xmlReport = new CloverLoader(__DIR__ . '/fixtures/coverage.xml');
36
37
        $this->assertNull($xmlReport->handleNotFoundFile());
38
    }
39
}
40