1 | <?php namespace Phprest\Router; |
||
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 |