Code Duplication    Length = 22-23 lines in 2 locations

tests/JacocoLoaderTest.php 1 location

@@ 10-32 (lines=23) @@
7
8
class JacocoLoaderTest extends TestCase
9
{
10
    public function testLoadXML()
11
    {
12
        $xmlReport = new JacocoReport(__DIR__ . '/fixtures/jacoco.xml');
13
        $coveredLines = $xmlReport->parseLines();
14
        $expected = [
15
            'org/jacoco/examples/maven/java/HelloWorld.java',
16
            'org/jacoco/examples/maven/java/New/HelloWorld.java',
17
18
        ];
19
20
        $this->assertEquals($expected, $coveredLines);
21
22
        $this->assertEquals(
23
            [],
24
            $xmlReport->getErrorsOnLine('org/jacoco/examples/maven/java/HelloWorld.java', 3)
25
        );
26
        $this->assertEquals(
27
            ['No unit test covering this line'],
28
            $xmlReport->getErrorsOnLine('org/jacoco/examples/maven/java/HelloWorld.java', 7)
29
        );
30
31
        $this->assertNull($xmlReport->getErrorsOnLine('doesntExist.java', 10));
32
    }
33
}
34

tests/LoadCloverReportTest.php 1 location

@@ 10-31 (lines=22) @@
7
8
class LoadCloverReportTest extends TestCase
9
{
10
    public function testLoadXML()
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
    {