diff --git a/_tests/unit/RouterTest.php b/_tests/unit/RouterTest.php index e8f4a3f..ffba028 100644 --- a/_tests/unit/RouterTest.php +++ b/_tests/unit/RouterTest.php @@ -24,9 +24,9 @@ class RouterTest extends \PHPUnit\Framework\TestCase ['controller' => 'posts', 'action' => 'new'] ], [ - '{controller}/{id:\d+}/{action}', + '{controller}/{action}/{id:\d+}', [], - 'posts/3/edit', + 'posts/edit/3', ['controller' => 'posts', 'action' => 'edit', 'id' => '3'] ], [ diff --git a/public/index.php b/public/index.php index 028dc42..c5cca77 100644 --- a/public/index.php +++ b/public/index.php @@ -3,7 +3,7 @@ $router = new Router(); $router->add('', ['controller' => 'Data', 'action' => 'index']); $router->add('{controller}/{action}'); -$router->add('{controller}/{id:\d+}/{action}'); +$router->add('{controller}/{action}/{id:\d+}'); $url = $_SERVER['QUERY_STRING']; $router->dispatch($url);