Passed
Push — master ( 65716f...f412dc )
by Alex
08:07
created

BigSetOfRoutesUnitTest::testBigSetOfRoutes()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 15
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 6
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 15
rs 10
1
<?php
2
namespace Mezon\Router\Tests;
3
4
use PHPUnit\Framework\TestCase;
5
use Mezon\Router\Router;
6
7
class BigSetOfRoutesUnitTest extends TestCase
8
{
9
10
    /**
11
     * Method provides testing data
12
     *
13
     * @return array testing data
14
     */
15
    public function bigSetOfRoutesDataProvider(): array
16
    {
17
        return [
18
            [
19
                99
20
            ],
21
            [
22
                101
23
            ]
24
        ];
25
    }
26
27
    /**
28
     * Testing method
29
     *
30
     * @param int $amount
31
     *            amount of routes
32
     * @dataProvider bigSetOfRoutesDataProvider
33
     */
34
    public function testBigSetOfRoutes(int $amount): void
35
    {
36
        // setup
37
        $router = new Router();
38
        for ($i = 1; $i <= $amount; $i ++) {
39
            $router->addRoute('/param/[i:id]/' . $i, function () use ($i): int {
40
                return $i;
41
            });
42
        }
43
44
        // test body
45
        $result = $router->callRoute('/param/1/' . $amount);
46
47
        // assertions
48
        $this->assertEquals($amount, $result);
49
    }
50
}
51