From d5891571da87897fda1b5cdd56bb13ddcf0ebe9e Mon Sep 17 00:00:00 2001 From: jrfnl Date: Tue, 1 Mar 2022 23:06:53 +0100 Subject: [PATCH] CS/QA: Tests: add PSR-4 compliant namespace declarations Includes: * Renaming the files to reflect the name of the class therein and to use the `php` instead of `phpt` file extension. * Updating the `autoload-dev` directive in the `composer.json` file. * Updating the exclusions in the PHPCS config. Note: using PSR-4 compliant `*Test,php` filenames will (temporarily) silently break the running of the tests for PHP 5.3-5.5 as Nette Tester 1.x can't find the tests anymore. We can ignore this for now as this will be fixed in one of the next PRs where the tests will switch over to the PHPUnit testing framework. --- composer.json | 6 +++--- phpcs.xml.dist | 10 +++++----- tests/{Manager.run.phpt => ManagerRunTest.php} | 2 ++ tests/{Output.phpt => OutputTest.php} | 2 ++ ...ParallelLint.lint.phpt => ParallelLintLintTest.php} | 2 ++ ...seArguments.phpt => SettingsParseArgumentsTest.php} | 2 ++ .../{SkipLintProcess.phpt => SkipLintProcessTest.php} | 2 ++ ...essage.phpt => SyntaxErrorNormalizeMessageTest.php} | 2 ++ 8 files changed, 20 insertions(+), 8 deletions(-) rename tests/{Manager.run.phpt => ManagerRunTest.php} (98%) rename tests/{Output.phpt => OutputTest.php} (98%) rename tests/{ParallelLint.lint.phpt => ParallelLintLintTest.php} (99%) rename tests/{Settings.parseArguments.phpt => SettingsParseArgumentsTest.php} (99%) rename tests/{SkipLintProcess.phpt => SkipLintProcessTest.php} (95%) rename tests/{SyntaxError.normalizeMessage.phpt => SyntaxErrorNormalizeMessageTest.php} (95%) diff --git a/composer.json b/composer.json index 3b33405..300c87d 100644 --- a/composer.json +++ b/composer.json @@ -37,9 +37,9 @@ } }, "autoload-dev": { - "classmap": [ - "./tests/" - ] + "psr-4": { + "PHP_Parallel_Lint\\PhpParallelLint\\Tests\\": "tests/" + } }, "bin": [ "parallel-lint" diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 99644bf..dba4930 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -85,13 +85,13 @@ - /tests/Output\.phpt$ - - - /tests/*\.php[t]?$ + /tests/OutputTest\.php$ - /tests/*\.phpt$ + /tests/*\.php$ + + + /tests/skip-on-5\.3/*\.php$ /tests/skip-on-5.3/trait\.php$ diff --git a/tests/Manager.run.phpt b/tests/ManagerRunTest.php similarity index 98% rename from tests/Manager.run.phpt rename to tests/ManagerRunTest.php index 982881f..55194f0 100644 --- a/tests/Manager.run.phpt +++ b/tests/ManagerRunTest.php @@ -4,6 +4,8 @@ * @testCase */ +namespace PHP_Parallel_Lint\PhpParallelLint\Tests; + require_once __DIR__ . '/../src/polyfill.php'; require __DIR__ . '/../vendor/autoload.php'; diff --git a/tests/Output.phpt b/tests/OutputTest.php similarity index 98% rename from tests/Output.phpt rename to tests/OutputTest.php index f3453d2..ea11686 100644 --- a/tests/Output.phpt +++ b/tests/OutputTest.php @@ -4,6 +4,8 @@ * @testCase */ +namespace PHP_Parallel_Lint\PhpParallelLint\Tests; + require_once __DIR__ . '/../src/polyfill.php'; require __DIR__ . '/../vendor/autoload.php'; diff --git a/tests/ParallelLint.lint.phpt b/tests/ParallelLintLintTest.php similarity index 99% rename from tests/ParallelLint.lint.phpt rename to tests/ParallelLintLintTest.php index 30b28ac..0d2e478 100644 --- a/tests/ParallelLint.lint.phpt +++ b/tests/ParallelLintLintTest.php @@ -4,6 +4,8 @@ * @testCase */ +namespace PHP_Parallel_Lint\PhpParallelLint\Tests; + require_once __DIR__ . '/../src/polyfill.php'; require __DIR__ . '/../vendor/autoload.php'; diff --git a/tests/Settings.parseArguments.phpt b/tests/SettingsParseArgumentsTest.php similarity index 99% rename from tests/Settings.parseArguments.phpt rename to tests/SettingsParseArgumentsTest.php index 46fe83a..48cbadc 100644 --- a/tests/Settings.parseArguments.phpt +++ b/tests/SettingsParseArgumentsTest.php @@ -4,6 +4,8 @@ * @testCase */ +namespace PHP_Parallel_Lint\PhpParallelLint\Tests; + require_once __DIR__ . '/../src/polyfill.php'; require __DIR__ . '/../vendor/autoload.php'; diff --git a/tests/SkipLintProcess.phpt b/tests/SkipLintProcessTest.php similarity index 95% rename from tests/SkipLintProcess.phpt rename to tests/SkipLintProcessTest.php index ada9125..88fd086 100644 --- a/tests/SkipLintProcess.phpt +++ b/tests/SkipLintProcessTest.php @@ -4,6 +4,8 @@ * @testCase */ +namespace PHP_Parallel_Lint\PhpParallelLint\Tests; + require_once __DIR__ . '/../src/polyfill.php'; require __DIR__ . '/../vendor/autoload.php'; diff --git a/tests/SyntaxError.normalizeMessage.phpt b/tests/SyntaxErrorNormalizeMessageTest.php similarity index 95% rename from tests/SyntaxError.normalizeMessage.phpt rename to tests/SyntaxErrorNormalizeMessageTest.php index e3558ea..69249b4 100644 --- a/tests/SyntaxError.normalizeMessage.phpt +++ b/tests/SyntaxErrorNormalizeMessageTest.php @@ -4,6 +4,8 @@ * @testCase */ +namespace PHP_Parallel_Lint\PhpParallelLint\Tests; + require_once __DIR__ . '/../src/polyfill.php'; require __DIR__ . '/../vendor/autoload.php';