PhpcpdTest::testNotFoundFile()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
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