Completed
Push — master ( 9bf55b...1ce859 )
by Jefersson
25s
created

FeatureResolveTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 38
rs 10

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
7
final class FeatureResolveTest extends \PHPUnit_Framework_TestCase
8
{
9
    /**
10
     * @dataProvider unExistsDirectory
11
     *
12
     * @param string $directory
13
     * @param string $expectedDirectory
14
     * @param string $expectedFile
15
     */
16
    public function testShouldReturnCorrectDirectory(
17
        $directory,
18
        $expectedDirectory,
19
        $expectedFile
20
    ) {
21
        $feature = new FeatureResolve($directory);
22
23
        self::assertSame($directory, self::getObjectAttribute($feature, 'directoryOrFile'));
24
25
        $getDirectoryMethod = new \ReflectionMethod('KawaiiGherkin\FeatureResolve', 'getDirectory');
26
        $getDirectoryMethod->setAccessible(true);
27
        self::assertSame($expectedDirectory, $getDirectoryMethod->invoke($feature));
28
29
        $getFeatureMatch = new \ReflectionMethod('KawaiiGherkin\FeatureResolve', 'getFeatureMatch');
30
        $getFeatureMatch->setAccessible(true);
31
        self::assertSame($expectedFile, $getFeatureMatch->invoke($feature));
32
    }
33
34
    public function unExistsDirectory()
35
    {
36
        return [
37
            ['null/*.feature', 'null', '*.feature'],
38
            ['foo-bar/none.feature', 'foo-bar', 'none.feature'],
39
            ['none/foo.text', 'none', 'foo.text'],
40
            ['foo-barr/bar.feature', 'foo-barr', 'bar.feature'],
41
            ['bar/biz/boo/feature.feature', 'bar/biz/boo', 'feature.feature'],
42
        ];
43
    }
44
}
45