AddRouteUnitTestClass   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 12
c 0
b 0
f 0
dl 0
loc 45
rs 10

3 Methods

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