Code Duplication    Length = 32-33 lines in 2 locations

tests/PhanTextTest.php 1 location

@@ 7-39 (lines=33) @@
4
use PHPUnit\Framework\TestCase;
5
use exussum12\CoverageChecker\PhanTextLoader;
6
7
class PhanTextTest extends TestCase
8
{
9
    /** @var  PhanTextLoader */
10
    protected $phan;
11
    protected function setUp()
12
    {
13
        parent::setUp();
14
        $this->phan = new PhanTextLoader(__DIR__ . '/fixtures/phan.txt');
15
    }
16
17
    public function testOutput()
18
    {
19
        $file1 = 'src/ArgParser.php';
20
21
        $lines = $this->phan->parseLines();
22
23
        $this->assertCount(2, $lines);
24
25
        $this->assertContains(
26
            'Argument 1 (string) is int but \strlen() takes string',
27
            current($this->phan->getErrorsOnLine($file1, 35))
28
        );
29
        $this->assertEquals(
30
            [],
31
            $this->phan->getErrorsOnLine($file1, 30)
32
        );
33
    }
34
35
    public function testNotFoundFile()
36
    {
37
        $this->assertTrue($this->phan->handleNotFoundFile());
38
    }
39
}
40

tests/PhpcpdTest.php 1 location

@@ 7-38 (lines=32) @@
4
use PHPUnit\Framework\TestCase;
5
use exussum12\CoverageChecker\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
        $this->cpd->parseLines();
16
    }
17
18
    public function testOutput()
19
    {
20
21
        $file1 = '/home/user/code/coverageChecker/vendor/symfony/console/Tests/Helper/SymfonyQuestionHelperTest.php';
22
        $file2 = '/home/user/code/coverageChecker/vendor/symfony/console/Tests/Helper/QuestionHelperTest.php';
23
24
        $this->assertEquals(
25
            ["Duplicate of $file2:58-60"],
26
            $this->cpd->getErrorsOnLine($file1, 45)
27
        );
28
        $this->assertEquals(
29
            [],
30
            $this->cpd->getErrorsOnLine($file1, 49)
31
        );
32
    }
33
34
    public function testNotFoundFile()
35
    {
36
        $this->assertTrue($this->cpd->handleNotFoundFile());
37
    }
38
}
39