Added new Router test.

This commit is contained in:
Lonnie Ezell 2017-08-16 23:02:36 -05:00
parent abee717a2c
commit f44b7f6515
No known key found for this signature in database
GPG Key ID: 8EB408F8D82F5002

View File

@ -31,6 +31,7 @@ class RouterTest extends \CIUnitTestCase
'{locale}/pages' => 'App\Pages::list_all',
'Admin/Admins' => 'App\Admin\Admins::list_all',
'/some/slash' => 'App\Slash::index',
'objects/(:segment)/sort/(:segment)/([A-Z]{3,7})' => 'AdminList::objectsSortCreate/$1/$2/$3'
];
$this->collection->map($routes);
@ -128,6 +129,21 @@ class RouterTest extends \CIUnitTestCase
//--------------------------------------------------------------------
/**
* @see https://github.com/bcit-ci/CodeIgniter4/issues/672
*/
public function testURIMapsParamsWithMany()
{
$router = new Router($this->collection);
$router->handle('objects/123/sort/abc/FOO');
$this->assertEquals('objectsSortCreate', $router->methodName());
$this->assertEquals([123, 'abc', 'FOO'], $router->params());
}
//--------------------------------------------------------------------
public function testClosures()
{
$router = new Router($this->collection);