Conditions | 1 |
Paths | 1 |
Total Lines | 22 |
Code Lines | 13 |
Lines | 22 |
Ratio | 100 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | View Code Duplication | 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 | |||
40 |
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.