This repository has been archived on 2022-02-10. You can view files and clone it, but cannot push or open issues or pull requests.
rangitaki/vendor/nikic/fast-route/test/RouteCollectorTest.php
Marcel Kapfer (mmk2410) 623395064f composer update
2016-12-30 00:04:12 +01:00

35 lines
No EOL
948 B
PHP

<?php
namespace FastRoute;
class RouteCollectorTest extends \PHPUnit_Framework_TestCase {
public function testShortcuts() {
$r = new DummyRouteCollector();
$r->delete('/delete', 'delete');
$r->get('/get', 'get');
$r->head('/head', 'head');
$r->patch('/patch', 'patch');
$r->post('/post', 'post');
$r->put('/put', 'put');
$expected = [
['DELETE', '/delete', 'delete'],
['GET', '/get', 'get'],
['HEAD', '/head', 'head'],
['PATCH', '/patch', 'patch'],
['POST', '/post', 'post'],
['PUT', '/put', 'put'],
];
$this->assertSame($expected, $r->routes);
}
}
class DummyRouteCollector extends RouteCollector {
public $routes = [];
public function __construct() {}
public function addRoute($method, $route, $handler) {
$this->routes[] = [$method, $route, $handler];
}
}