From 450eea84eab521080e832a55e7bf9c36ec50c356 Mon Sep 17 00:00:00 2001 From: fadrian06 Date: Thu, 26 Mar 2026 03:36:25 -0400 Subject: [PATCH] simplify autoload-dev to a single psr-4 autoload --- composer.json | 12 ++---------- phpunit.xml.dist | 2 +- .../FlightRouteCompactSyntaxTest.php | 5 +---- .../PostsController.php | 2 +- .../TodosController.php | 2 +- .../UsersController.php | 2 +- .../ExampleClass.php | 2 ++ .../FlightTest.php | 3 +-- tests/server/AuthCheck.php | 2 +- tests/server/LayoutMiddleware.php | 2 +- tests/server/OverwriteBodyMiddleware.php | 2 +- tests/server/Pascal_Snake_Case.php | 2 +- tests/server/index.php | 8 ++++---- tests/{server-v2 => server_v2}/index.php | 4 ++-- tests/{server-v2 => server_v2}/template.phtml | 0 15 files changed, 20 insertions(+), 30 deletions(-) rename tests/{groupcompactsyntax => group_compact_syntax}/FlightRouteCompactSyntaxTest.php (96%) rename tests/{groupcompactsyntax => group_compact_syntax}/PostsController.php (93%) rename tests/{groupcompactsyntax => group_compact_syntax}/TodosController.php (83%) rename tests/{groupcompactsyntax => group_compact_syntax}/UsersController.php (84%) rename tests/{named-arguments => named_arguments}/ExampleClass.php (78%) rename tests/{named-arguments => named_arguments}/FlightTest.php (98%) rename tests/{server-v2 => server_v2}/index.php (99%) rename tests/{server-v2 => server_v2}/template.phtml (100%) diff --git a/composer.json b/composer.json index edcb703..5e72dd7 100644 --- a/composer.json +++ b/composer.json @@ -35,16 +35,8 @@ } }, "autoload-dev": { - "classmap": [ - "tests/classes/" - ], "psr-4": { - "Tests\\PHP8\\": [ - "tests/named-arguments" - ], - "Tests\\Server\\": "tests/server", - "Tests\\ServerV2\\": "tests/server-v2", - "tests\\groupcompactsyntax\\": "tests/groupcompactsyntax" + "tests\\": "tests" } }, "require-dev": { @@ -84,7 +76,7 @@ ], "test-server-v2": [ "echo \"Running Test Server\"", - "@php -S localhost:8000 -t tests/server-v2" + "@php -S localhost:8000 -t tests/server_v2" ], "test-coverage:win": [ "del clover.xml", diff --git a/phpunit.xml.dist b/phpunit.xml.dist index b890bb7..b205597 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -22,7 +22,7 @@ tests/ - tests/named-arguments/ + tests/named_arguments/ diff --git a/tests/groupcompactsyntax/FlightRouteCompactSyntaxTest.php b/tests/group_compact_syntax/FlightRouteCompactSyntaxTest.php similarity index 96% rename from tests/groupcompactsyntax/FlightRouteCompactSyntaxTest.php rename to tests/group_compact_syntax/FlightRouteCompactSyntaxTest.php index 84d168f..2c8d3a1 100644 --- a/tests/groupcompactsyntax/FlightRouteCompactSyntaxTest.php +++ b/tests/group_compact_syntax/FlightRouteCompactSyntaxTest.php @@ -2,13 +2,10 @@ declare(strict_types=1); -namespace tests\groupcompactsyntax; +namespace tests\group_compact_syntax; use Flight; use PHPUnit\Framework\TestCase; -use tests\groupcompactsyntax\PostsController; -use tests\groupcompactsyntax\TodosController; -use tests\groupcompactsyntax\UsersController; final class FlightRouteCompactSyntaxTest extends TestCase { diff --git a/tests/groupcompactsyntax/PostsController.php b/tests/group_compact_syntax/PostsController.php similarity index 93% rename from tests/groupcompactsyntax/PostsController.php rename to tests/group_compact_syntax/PostsController.php index f95f60d..5e693fb 100644 --- a/tests/groupcompactsyntax/PostsController.php +++ b/tests/group_compact_syntax/PostsController.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace tests\groupcompactsyntax; +namespace tests\group_compact_syntax; final class PostsController { diff --git a/tests/groupcompactsyntax/TodosController.php b/tests/group_compact_syntax/TodosController.php similarity index 83% rename from tests/groupcompactsyntax/TodosController.php rename to tests/group_compact_syntax/TodosController.php index 91c30cf..744f6b7 100644 --- a/tests/groupcompactsyntax/TodosController.php +++ b/tests/group_compact_syntax/TodosController.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace tests\groupcompactsyntax; +namespace tests\group_compact_syntax; final class TodosController { diff --git a/tests/groupcompactsyntax/UsersController.php b/tests/group_compact_syntax/UsersController.php similarity index 84% rename from tests/groupcompactsyntax/UsersController.php rename to tests/group_compact_syntax/UsersController.php index d6372b5..7323771 100644 --- a/tests/groupcompactsyntax/UsersController.php +++ b/tests/group_compact_syntax/UsersController.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace tests\groupcompactsyntax; +namespace tests\group_compact_syntax; final class UsersController { diff --git a/tests/named-arguments/ExampleClass.php b/tests/named_arguments/ExampleClass.php similarity index 78% rename from tests/named-arguments/ExampleClass.php rename to tests/named_arguments/ExampleClass.php index 508068c..9555047 100644 --- a/tests/named-arguments/ExampleClass.php +++ b/tests/named_arguments/ExampleClass.php @@ -2,6 +2,8 @@ declare(strict_types=1); +namespace tests\named_arguments; + // phpcs:ignore PSR1.Classes.ClassDeclaration.MissingNamespace class ExampleClass { diff --git a/tests/named-arguments/FlightTest.php b/tests/named_arguments/FlightTest.php similarity index 98% rename from tests/named-arguments/FlightTest.php rename to tests/named_arguments/FlightTest.php index 6593450..9053b02 100644 --- a/tests/named-arguments/FlightTest.php +++ b/tests/named_arguments/FlightTest.php @@ -2,10 +2,9 @@ declare(strict_types=1); -namespace Tests\PHP8; +namespace tests\named_arguments; use DateTimeImmutable; -use ExampleClass; use Flight; use flight\Container; use flight\Engine; diff --git a/tests/server/AuthCheck.php b/tests/server/AuthCheck.php index 79e8f67..c042c1b 100644 --- a/tests/server/AuthCheck.php +++ b/tests/server/AuthCheck.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Server; +namespace tests\server; class AuthCheck { diff --git a/tests/server/LayoutMiddleware.php b/tests/server/LayoutMiddleware.php index 150985b..01058c0 100644 --- a/tests/server/LayoutMiddleware.php +++ b/tests/server/LayoutMiddleware.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Server; +namespace tests\server; use Flight; diff --git a/tests/server/OverwriteBodyMiddleware.php b/tests/server/OverwriteBodyMiddleware.php index 98e8468..6a3dfa8 100644 --- a/tests/server/OverwriteBodyMiddleware.php +++ b/tests/server/OverwriteBodyMiddleware.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Server; +namespace tests\server; use Flight; diff --git a/tests/server/Pascal_Snake_Case.php b/tests/server/Pascal_Snake_Case.php index d80ed41..df9a66f 100644 --- a/tests/server/Pascal_Snake_Case.php +++ b/tests/server/Pascal_Snake_Case.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Server; +namespace tests\server; class Pascal_Snake_Case // phpcs:ignore { diff --git a/tests/server/index.php b/tests/server/index.php index 6bb9dca..f4193e8 100644 --- a/tests/server/index.php +++ b/tests/server/index.php @@ -7,10 +7,10 @@ use flight\core\Loader; use flight\database\PdoWrapper; use tests\classes\Container; use tests\classes\ContainerDefault; -use Tests\Server\AuthCheck; -use Tests\Server\LayoutMiddleware; -use Tests\Server\OverwriteBodyMiddleware; -use Tests\Server\Pascal_Snake_Case; +use tests\server\AuthCheck; +use tests\server\LayoutMiddleware; +use tests\server\OverwriteBodyMiddleware; +use tests\server\Pascal_Snake_Case; /* * This is the test file where we can open up a quick test server and make diff --git a/tests/server-v2/index.php b/tests/server_v2/index.php similarity index 99% rename from tests/server-v2/index.php rename to tests/server_v2/index.php index 4f45d99..1aadcc1 100644 --- a/tests/server-v2/index.php +++ b/tests/server_v2/index.php @@ -9,7 +9,7 @@ declare(strict_types=1); * @author Kristaps Muižnieks https://github.com/krmu */ -namespace Tests\ServerV2 { +namespace tests\server_v2 { class AuthCheck { public function before(): void @@ -23,7 +23,7 @@ namespace Tests\ServerV2 { namespace { - use Tests\ServerV2\AuthCheck; + use tests\server_v2\AuthCheck; require_once __DIR__ . '/../phpunit_autoload.php'; diff --git a/tests/server-v2/template.phtml b/tests/server_v2/template.phtml similarity index 100% rename from tests/server-v2/template.phtml rename to tests/server_v2/template.phtml