for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace PhpLightningTest\Unit\Router;
use PhpLightning\Router\Router;
use PHPUnit\Framework\TestCase;
final class RouterTest extends TestCase
{
public function test_404_no_route_found(): void
$router = Router::withServer([
'REQUEST_METHOD' => 'GET',
'REQUEST_URI' => '/foo/?bar=123000',
]);
$router->listen();
$this->expectOutputString("404: route '/foo' not found");
}
public function test_static_get_route_found(): void
$router->get('/foo', static function (): void {
echo 'route found';
});
$this->expectOutputString('route found');
public function test_dynamic_get_route_found(): void
$router->get('/$name', static function (string $name): void {
echo "route '{$name}' found";
$this->expectOutputString("route 'foo' found");