Completed
Push — master ( 15f476...52f8b5 )
by Alex
07:26
created

testMethodNameToRouteConversion()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 7
rs 10
1
<?php
2
namespace Mezon\Router\Tests;
3
4
class RouterUtilsUnitTest extends \PHPUnit\Framework\TestCase
5
{
6
7
    /**
8
     * Datapdovider for the test testGetCallableDescription
9
     *
10
     * @return array testing data
11
     */
12
    public function getCallableDescriptionDataProvider(): array
13
    {
14
        return [
15
            [
16
                'string-processor',
17
                'string-processor'
18
            ],
19
            [
20
                [
21
                    $this,
22
                    'getCallableDescriptionDataProvider'
23
                ],
24
                get_class($this) . '::getCallableDescriptionDataProvider'
25
            ],
26
            [
27
                [
28
                    'class-name',
29
                    'static-method-name'
30
                ],
31
                'class-name::static-method-name'
32
            ]
33
        ];
34
    }
35
36
    /**
37
     * Testing getCallableDescription method
38
     *
39
     * @param mixed $callable
40
     * @param string $result
41
     * @dataProvider getCallableDescriptionDataProvider
42
     */
43
    public function testGetCallableDescription($callable, string $result): void
44
    {
45
        // test body and assertions
46
        $this->assertEquals($result, \Mezon\Router\Utils::getCallableDescription($callable));
47
    }
48
49
    /**
50
     * Testing convertMethodNameToRoute
51
     */
52
    public function testMethodNameToRouteConversion(): void
53
    {
54
        // test body
55
        $result = \Mezon\Router\Utils::convertMethodNameToRoute('actionSomeRouter');
56
57
        // assertions
58
        $this->assertEquals('some-router', $result);
59
    }
60
}
61