diff --git a/composer.json b/composer.json index bf59bbf4..bf9a243e 100644 --- a/composer.json +++ b/composer.json @@ -33,11 +33,11 @@ }, "autoload-dev": { "classmap": [ - "tests/classes/User.php", - "tests/classes/Hello.php", - "tests/classes/Factory.php", - "tests/classes/TesterClass.php" - ] + "tests/classes/" + ], + "psr-4": { + "Tests\\PHP8\\": ["tests/named-arguments"] + } }, "require-dev": { "ext-pdo_sqlite": "*", diff --git a/phpunit.xml b/phpunit.xml index cb460e51..b890bb7f 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -22,6 +22,7 @@ tests/ + tests/named-arguments/ diff --git a/tests/named-arguments/ExampleClass.php b/tests/named-arguments/ExampleClass.php new file mode 100644 index 00000000..581551d3 --- /dev/null +++ b/tests/named-arguments/ExampleClass.php @@ -0,0 +1,5 @@ +status()); + } + + public function test_halt(): void + { + Flight::halt(500, actuallyExit: false, message: 'Test'); + + self::expectOutputString('Test'); + self::assertSame(500, Flight::response()->status()); + } + + ///////////////////// + // ROUTING METHODS // + ///////////////////// + public function test_static_route(): void + { + Flight::request()->url = '/test'; + + $route = Flight::route( + pass_route: true, + alias: 'testRoute', + callback: function () { + echo 'test'; + }, + pattern: '/test' + ); + + self::assertInstanceOf(Route::class, $route); + self::expectOutputString('test'); + Flight::start(); + } +}