Skip to content

Commit 9e024d4

Browse files
jrfnlgrogy
authored andcommitted
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.
1 parent 134396d commit 9e024d4

8 files changed

+20
-8
lines changed

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@
3737
}
3838
},
3939
"autoload-dev": {
40-
"classmap": [
41-
"./tests/"
42-
]
40+
"psr-4": {
41+
"PHP_Parallel_Lint\\PhpParallelLint\\Tests\\": "tests/"
42+
}
4343
},
4444
"bin": [
4545
"parallel-lint"

phpcs.xml.dist

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,13 @@
8585

8686
<!-- To be addressed in test refactor. -->
8787
<rule ref="PSR1.Classes.ClassDeclaration.MultipleClasses">
88-
<exclude-pattern>/tests/Output\.phpt$</exclude-pattern>
89-
</rule>
90-
<rule ref="PSR1.Classes.ClassDeclaration.MissingNamespace">
91-
<exclude-pattern>/tests/*\.php[t]?$</exclude-pattern>
88+
<exclude-pattern>/tests/OutputTest\.php$</exclude-pattern>
9289
</rule>
9390
<rule ref="PSR1.Files.SideEffects.FoundWithSymbols">
94-
<exclude-pattern>/tests/*\.phpt$</exclude-pattern>
91+
<exclude-pattern>/tests/*\.php$</exclude-pattern>
92+
</rule>
93+
<rule ref="PSR1.Classes.ClassDeclaration.MissingNamespace">
94+
<exclude-pattern>/tests/skip-on-5\.3/*\.php$</exclude-pattern>
9595
</rule>
9696
<rule ref="PSR12.Files.FileHeader.SpacingAfterBlock">
9797
<exclude-pattern>/tests/skip-on-5.3/trait\.php$</exclude-pattern>

tests/Manager.run.phpt renamed to tests/ManagerRunTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
* @testCase
55
*/
66

7+
namespace PHP_Parallel_Lint\PhpParallelLint\Tests;
8+
79
require_once __DIR__ . '/../src/polyfill.php';
810
require __DIR__ . '/../vendor/autoload.php';
911

tests/Output.phpt renamed to tests/OutputTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
* @testCase
55
*/
66

7+
namespace PHP_Parallel_Lint\PhpParallelLint\Tests;
8+
79
require_once __DIR__ . '/../src/polyfill.php';
810
require __DIR__ . '/../vendor/autoload.php';
911

tests/ParallelLint.lint.phpt renamed to tests/ParallelLintLintTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
* @testCase
55
*/
66

7+
namespace PHP_Parallel_Lint\PhpParallelLint\Tests;
8+
79
require_once __DIR__ . '/../src/polyfill.php';
810
require __DIR__ . '/../vendor/autoload.php';
911

tests/Settings.parseArguments.phpt renamed to tests/SettingsParseArgumentsTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
* @testCase
55
*/
66

7+
namespace PHP_Parallel_Lint\PhpParallelLint\Tests;
8+
79
require_once __DIR__ . '/../src/polyfill.php';
810
require __DIR__ . '/../vendor/autoload.php';
911

tests/SkipLintProcess.phpt renamed to tests/SkipLintProcessTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
* @testCase
55
*/
66

7+
namespace PHP_Parallel_Lint\PhpParallelLint\Tests;
8+
79
require_once __DIR__ . '/../src/polyfill.php';
810
require __DIR__ . '/../vendor/autoload.php';
911

tests/SyntaxError.normalizeMessage.phpt renamed to tests/SyntaxErrorNormalizeMessageTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
* @testCase
55
*/
66

7+
namespace PHP_Parallel_Lint\PhpParallelLint\Tests;
8+
79
require_once __DIR__ . '/../src/polyfill.php';
810
require __DIR__ . '/../vendor/autoload.php';
911

0 commit comments

Comments
 (0)