Passed
Push — master ( 1cf0a9...56b73d )
by Ayan
01:37
created

RouteCollectionTest::testGetRoutingTable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 16
rs 9.7333
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php namespace Phprest\Router;
2
3
use PHPUnit\Framework\TestCase;
4
5
class RouteCollectionTest extends TestCase
6
{
7
    public function testGetRoutingTable(): void
8
    {
9
        $routeCollection = new RouteCollection();
10
11
        $routeCollection->addRoute('GET', '/temperatures', function () {
12
        });
13
        $routeCollection->addRoute('GET', '/temperatures/1', function () {
14
        });
15
        $routeCollection->addRoute('POST', '/camera', function () {
16
        });
17
18
        $this->assertCount(3, $routeCollection->getRoutingTable());
19
        $this->assertEquals('/temperatures', $routeCollection->getRoutingTable()[0]['route']);
20
        $this->assertEquals('/temperatures/1', $routeCollection->getRoutingTable()[1]['route']);
21
        $this->assertEquals('/camera', $routeCollection->getRoutingTable()[2]['route']);
22
    }
23
}
24