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

BigSetOfRoutesUnitTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 42
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A bigSetOfRoutesDataProvider() 0 8 1
A testBigSetOfRoutes() 0 15 2
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