Completed
Push — master ( 81ce9d...1672d9 )
by Oleg
03:54
created

Psr4FileNameProviderTest::fileContentsProvider()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 42
Code Lines 39

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 39
nc 1
nop 0
dl 0
loc 42
rs 8.8571
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
4
namespace SlayerBirden\DFCodeGeneration\Writer;
5
6
use PHPUnit\Framework\TestCase;
7
8
class Psr4FileNameProviderTest extends TestCase
9
{
10
    /**
11
     * @dataProvider fileContentsProvider
12
     *
13
     * @param $contents
14
     * @param $expectedFileName
15
     */
16
    public function testGetFileName($contents, $expectedFileName)
17
    {
18
        $provider = new Psr4FileNameProvider();
19
20
        $this->assertEquals($expectedFileName, $provider->getFileName($contents));
21
    }
22
23
    public function fileContentsProvider(): array
24
    {
25
        $body1 = <<<'BODY'
26
<?php
27
namespace Foo\Bar\Dummy\Controller;
28
class AddAction {}
29
BODY;
30
        $body2 = <<<'BODY'
31
<?php
32
namespace Foo\Bar\Dummy;
33
class ConfigProvider {}
34
BODY;
35
        $body3 = <<<'BODY'
36
<?php
37
namespace Foo\Bar\Baz;
38
class Dummy {}
39
BODY;
40
        $body4 = <<<'BODY'
41
<?php
42
class DummyCest {}
43
BODY;
44
        $body5 = <<<'BODY'
45
<?php
46
class GetDummiesCest {}
47
BODY;
48
        $body6 = <<<'BODY'
49
<?php
50
class AwesomeDummiesCest {}
51
BODY;
52
        $body7 = <<<'BODY'
53
<?php
54
class GetBusesCest {}
55
BODY;
56
57
        return [
58
            [$body1, 'src/Dummy/Controller/AddAction.php'],
59
            [$body2, 'src/Dummy/ConfigProvider.php'],
60
            [$body3, 'src/Baz/Dummy.php'],
61
            [$body4, 'tests/api/dummy/DummyCest.php'],
62
            [$body5, 'tests/api/dummy/GetDummiesCest.php'],
63
            [$body6, 'tests/api/awesomedummy/AwesomeDummiesCest.php'],
64
            [$body7, 'tests/api/bus/GetBusesCest.php'],
65
        ];
66
    }
67
}
68