FeatureResolveTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 38
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testShouldReturnCorrectDirectory() 0 17 1
A unExistsDirectory() 0 10 1
1
<?php
2
3
namespace KawaiiGherkinTest;
4
5
use KawaiiGherkin\FeatureResolve;
6
use PHPUnit\Framework\TestCase;
7
8
final class FeatureResolveTest extends TestCase
9
{
10
    /**
11
     * @dataProvider unExistsDirectory
12
     *
13
     * @param string $directory
14
     * @param string $expectedDirectory
15
     * @param string $expectedFile
16
     */
17
    public function testShouldReturnCorrectDirectory(
18
        $directory,
19
        $expectedDirectory,
20
        $expectedFile
21
    ) {
22
        $feature = new FeatureResolve($directory);
23
24
        self::assertSame($directory, self::getObjectAttribute($feature, 'directoryOrFile'));
25
26
        $getDirectoryMethod = new \ReflectionMethod('KawaiiGherkin\FeatureResolve', 'getDirectory');
27
        $getDirectoryMethod->setAccessible(true);
28
        self::assertSame($expectedDirectory, $getDirectoryMethod->invoke($feature));
29
30
        $getFeatureMatch = new \ReflectionMethod('KawaiiGherkin\FeatureResolve', 'getFeatureMatch');
31
        $getFeatureMatch->setAccessible(true);
32
        self::assertSame($expectedFile, $getFeatureMatch->invoke($feature));
33
    }
34
35
    public function unExistsDirectory()
36
    {
37
        return [
38
            ['null/*.feature', 'null', '*.feature'],
39
            ['foo-bar/none.feature', 'foo-bar', 'none.feature'],
40
            ['none/foo.text', 'none', 'foo.text'],
41
            ['foo-barr/bar.feature', 'foo-barr', 'bar.feature'],
42
            ['bar/biz/boo/feature.feature', 'bar/biz/boo', 'feature.feature'],
43
        ];
44
    }
45
}
46