test: add test cases for routes with integer

This commit is contained in:
kenjis 2024-06-12 09:12:28 +09:00
parent ce3750c8f8
commit 042525c67f
No known key found for this signature in database
GPG Key ID: BD254878922AF198

View File

@ -50,8 +50,10 @@ final class DefinedRouteCollectorTest extends CIUnitTestCase
{
$routes = $this->createRouteCollection();
$routes->get('journals', 'Blogs');
$routes->get('100', 'Home::index');
$routes->get('product/(:num)', 'Catalog::productLookupByID/$1');
$routes->get('feed', static fn () => 'A Closure route.');
$routes->get('200', static fn () => 'A Closure route.');
$routes->view('about', 'pages/about');
$collector = new DefinedRouteCollector($routes);
@ -69,6 +71,12 @@ final class DefinedRouteCollectorTest extends CIUnitTestCase
'name' => 'journals',
'handler' => '\App\Controllers\Blogs',
],
[
'method' => 'GET',
'route' => '100',
'name' => '100',
'handler' => '\App\Controllers\Home::index',
],
[
'method' => 'GET',
'route' => 'product/([0-9]+)',
@ -81,6 +89,12 @@ final class DefinedRouteCollectorTest extends CIUnitTestCase
'name' => 'feed',
'handler' => '(Closure)',
],
[
'method' => 'GET',
'route' => '200',
'name' => '200',
'handler' => '(Closure)',
],
[
'method' => 'GET',
'route' => 'about',