PrefixTest::testDoesNotExist()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 0
dl 0
loc 8
rs 10
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
class PrefixTest extends TestCase
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