testMethodNameToRouteConversion()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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