From 4b4f07ea56e59e38481a36cec1df2ff5fcd35a1e Mon Sep 17 00:00:00 2001 From: n0nag0n Date: Sat, 23 Mar 2024 12:49:09 -0600 Subject: [PATCH] added comment, removed unused file reference. --- flight/Flight.php | 5 ++++- tests/DocExamplesTest.php | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/flight/Flight.php b/flight/Flight.php index 0a42489..a04ad80 100644 --- a/flight/Flight.php +++ b/flight/Flight.php @@ -2,7 +2,6 @@ declare(strict_types=1); -use flight\core\Dispatcher; use flight\Engine; use flight\net\Request; use flight\net\Response; @@ -24,6 +23,10 @@ require_once __DIR__ . '/autoload.php'; * @method static void stop(?int $code = null) Stops the framework and sends a response. * @method static void halt(int $code = 200, string $message = '', bool $actuallyExit = true) * Stop the framework with an optional status code and message. + * @method static void register(string $name, string $class, array $params = [], ?callable $callback = null) + * Registers a class to a framework method. + * @method static void unregister(string $methodName) + * Unregisters a class to a framework method. * @method static void registerContainerHandler(callable|object $containerHandler) Registers a container handler. * * # Routing diff --git a/tests/DocExamplesTest.php b/tests/DocExamplesTest.php index 1518363..2bba482 100644 --- a/tests/DocExamplesTest.php +++ b/tests/DocExamplesTest.php @@ -74,4 +74,22 @@ class DocExamplesTest extends TestCase Flight::app()->handleException(new Exception('Error')); $this->expectOutputString('Custom: Error'); } + + public function testGetRouterStatically() + { + $router = Flight::router(); + Flight::request()->method = 'GET'; + Flight::request()->url = '/'; + + $router->get( + '/', + function () { + Flight::response()->write('from resp '); + } + ); + + Flight::start(); + + $this->expectOutputString('from resp '); + } }