From 675d80c4856e9f81abfe59562272ab334286c79d Mon Sep 17 00:00:00 2001 From: Rougin Gutib Date: Thu, 14 Dec 2023 00:37:24 +0800 Subject: [PATCH] Fix unit test in FastRouteDispatcherTest --- tests/Routing/FastRouteDispatcherTest.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tests/Routing/FastRouteDispatcherTest.php b/tests/Routing/FastRouteDispatcherTest.php index fd197b8..d16f785 100644 --- a/tests/Routing/FastRouteDispatcherTest.php +++ b/tests/Routing/FastRouteDispatcherTest.php @@ -39,15 +39,16 @@ public function testDispatchMethodWithClassAndSlytherinRouter() $router->prefix('', 'Rougin\Slytherin\Fixture\Classes'); - $router->get('/', 'NewClass@index'); + $router->get('/hi/:name', function ($name) + { + return 'Hello ' . $name . '!'; + }); $dispatcher = new FastRouteDispatcher($router); - $controller = new NewClass; + $route = $dispatcher->dispatch('GET', '/hi/Slytherin'); - $route = $dispatcher->dispatch('GET', '/'); - - $expected = (string) $controller->index(); + $expected = (string) 'Hello Slytherin!'; $actual = $this->resolve($route); @@ -69,13 +70,13 @@ public function testDispatchMethodWithClassAndPhrouteRouter() $router->prefix('', 'Rougin\Slytherin\Fixture\Classes'); - $router->get('/hello/:name', 'NewClass@index'); + $router->get('/', 'NewClass@index'); $dispatcher = new FastRouteDispatcher($router); $controller = new NewClass; - $route = $dispatcher->dispatch('GET', '/hello/Slytherin'); + $route = $dispatcher->dispatch('GET', '/'); $expected = (string) $controller->index();