PhpcpdTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 31
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 6 1
A testOutput() 0 13 1
A testNotFoundFile() 0 3 1
1
<?php
2
namespace exussum12\CoverageChecker\tests\Loaders;
3
4
use PHPUnit\Framework\TestCase;
5
use exussum12\CoverageChecker\Loaders\Phpcpd;
6
7
class PhpcpdTest extends TestCase
8
{
9
    /** @var  Phpcpd */
10
    protected $cpd;
11
    protected function setUp()
12
    {
13
        parent::setUp();
14
        $this->cpd = new Phpcpd(__DIR__ . '/../fixtures/phpcpd.txt');
15
16
        $this->cpd->parseLines();
17
    }
18
19
    public function testOutput()
20
    {
21
22
        $file1 = '/home/user/code/coverageChecker/vendor/symfony/console/Tests/Helper/SymfonyQuestionHelperTest.php';
23
        $file2 = '/home/user/code/coverageChecker/vendor/symfony/console/Tests/Helper/QuestionHelperTest.php';
24
25
        $this->assertEquals(
26
            ["Duplicate of $file2:58-60"],
27
            $this->cpd->getErrorsOnLine($file1, 45)
28
        );
29
        $this->assertEquals(
30
            [],
31
            $this->cpd->getErrorsOnLine($file1, 49)
32
        );
33
    }
34
35
    public function testNotFoundFile()
36
    {
37
        $this->assertTrue($this->cpd->handleNotFoundFile());
38
    }
39
}
40