Skip to content

Commit

Permalink
Merge pull request #564 from flightphp/misc-fixes
Browse files Browse the repository at this point in the history
added comment, removed unused file reference.
  • Loading branch information
n0nag0n authored Mar 30, 2024
2 parents 4fe54ea + 4b4f07e commit 3fda2b4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
5 changes: 4 additions & 1 deletion flight/Flight.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

declare(strict_types=1);

use flight\core\Dispatcher;
use flight\Engine;
use flight\net\Request;
use flight\net\Response;
Expand All @@ -24,6 +23,10 @@
* @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
Expand Down
18 changes: 18 additions & 0 deletions tests/DocExamplesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,22 @@ public function testMapErrorMethod()
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 ');
}
}

0 comments on commit 3fda2b4

Please sign in to comment.