diff --git a/app/Services/Hook.php b/app/Services/Hook.php index 07a0937b..d6c5a685 100644 --- a/app/Services/Hook.php +++ b/app/Services/Hook.php @@ -48,11 +48,9 @@ class Hook } /** - * Add a route. A router instance will be passed to the given callback. + * Add routes. A router instance will be passed to the given callback. * * @param Closure $callback - * - * TODO: Needs to be tested. */ public static function addRoute(Closure $callback) { diff --git a/tests/ServicesTest/HookTest.php b/tests/ServicesTest/HookTest.php index 3f5426f7..83233e29 100644 --- a/tests/ServicesTest/HookTest.php +++ b/tests/ServicesTest/HookTest.php @@ -35,6 +35,15 @@ class HookTest extends TestCase ->assertSee('/to/b'); } + public function testAddRoute() + { + Hook::addRoute(function ($route) { + $route->any('/test-hook', function () {}); + }); + event(new \App\Events\ConfigureRoutes(resolve(\Illuminate\Routing\Router::class))); + $this->get('/test-hook')->assertSuccessful(); + } + public function testRegisterPluginTransScripts() { $this->generateFakePlugin(['name' => 'fake-plugin-with-i18n', 'version' => '0.0.1']);