Passed
Branch master (cd2b9b)
by Scott
03:31
created

PrefixTest::testPrefix()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 10

Duplication

Lines 15
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 10
nc 1
nop 0
dl 15
loc 15
rs 9.4285
c 0
b 0
f 0
1
<?php
2
namespace exussum12\CoverageChecker\tests\FileMatchers;
3
4
use PHPUnit\Framework\TestCase;
5
use exussum12\CoverageChecker\Exceptions\FileNotFound;
6
use exussum12\CoverageChecker\FileMatchers\Prefix;
7
8 View Code Duplication
class PrefixTest extends TestCase
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

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.

Loading history...
9
{
10
    public function testPrefix()
11
    {
12
        $prefixMatcher = new Prefix('/full/path/to/');
13
        $needle = "file.php";
14
        $haystack = [
15
            '/full/path/to/someOtherFile.php',
16
            '/full/path/to/longer/file.php',
17
            '/full/path/to/file.php',
18
        ];
19
20
        $this->assertEquals(
21
            '/full/path/to/file.php',
22
            $prefixMatcher->match($needle, $haystack)
23
        );
24
    }
25
26
    public function testDoesNotExist()
27
    {
28
        $this->expectException(FileNotFound::class);
29
        $prefixMatcher = new Prefix('/full/path/to/');
30
        $needle = "fileDoesNotExist.php";
31
        $haystack = [];
32
33
        $prefixMatcher->match($needle, $haystack);
34
    }
35
}
36