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

RouteCollectionTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 2
dl 0
loc 19
rs 10
c 0
b 0
f 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