Skip to content

Commit 7240816

Browse files
committed
Support resource route when function with subdirectory.
example: $routes->resource('Admin/Admins');
1 parent 272fcdf commit 7240816

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/system/Router/RouterTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public function setUp()
2727
'books/(:num)/(:alpha)/(:num)' => 'Blog::show/$3/$1',
2828
'closure/(:num)/(:alpha)' => function ($num, $str) { return $num.'-'.$str; },
2929
'{locale}/pages' => 'App\Pages::list_all',
30+
'Admin/Admins' => 'App\Admin\Admins::list_all',
3031
];
3132

3233
$this->collection->map($routes);
@@ -192,4 +193,16 @@ public function testDetectsLocales()
192193

193194
//--------------------------------------------------------------------
194195

196+
public function testRouteResource()
197+
{
198+
$router = new Router($this->collection);
199+
200+
$router->handle('Admin/Admins');
201+
202+
$this->assertEquals('\App\Admin\Admins', $router->controllerName());
203+
$this->assertEquals('list_all', $router->methodName());
204+
}
205+
206+
//--------------------------------------------------------------------
207+
195208
}

0 commit comments

Comments
 (0)