Passed
Push — master ( 4cfdc5...37c7d0 )
by Alex
07:00
created

AddRouteUnitTestClass::actionRoute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
namespace Mezon\Router\Tests\Base;
3
4
/**
5
 * @psalm-suppress PropertyNotSetInConstructor
6
 */
7
abstract class AddRouteUnitTestClass extends BaseRouterUnitTestClass
8
{
9
10
    /**
11
     * Some action
12
     *
13
     * @return int
14
     */
15
    public function actionRoute(): int
16
    {
17
        return 1;
18
    }
19
20
    /**
21
     * Testing method addGetRoute
22
     */
23
    public function testAddGetRoute(): void
24
    {
25
        // setup
26
        $router = $this->getRouter();
27
        $route = 'route';
28
        RouterUnitTestUtils::setRequestMethod('GET');
29
30
        // test body
31
        $router->addGetRoute($route, $this, 'actionRoute');
32
33
        // assertions
34
        $this->assertEquals(1, $router->callRoute($route));
35
    }
36
37
    /**
38
     * Testing method addPostRoute
39
     */
40
    public function testAddPostRoute(): void
41
    {
42
        // setup
43
        $router = $this->getRouter();
44
        $route = 'route';
45
        RouterUnitTestUtils::setRequestMethod('POST');
46
47
        // test body
48
        $router->addPostRoute($route, $this, 'actionRoute');
49
50
        // assertions
51
        $this->assertEquals(1, $router->callRoute($route));
52
    }
53
}
54