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

Diff for: composer.json

+3-3
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"

Diff for: phpcs.xml.dist

+5-5
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>

Diff for: tests/Manager.run.phpt renamed to tests/ManagerRunTest.php

+2
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

Diff for: tests/Output.phpt renamed to tests/OutputTest.php

+2
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

Diff for: tests/ParallelLint.lint.phpt renamed to tests/ParallelLintLintTest.php

+2
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

Diff for: tests/Settings.parseArguments.phpt renamed to tests/SettingsParseArgumentsTest.php

+2
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

Diff for: tests/SkipLintProcess.phpt renamed to tests/SkipLintProcessTest.php

+2
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

Diff for: tests/SyntaxError.normalizeMessage.phpt renamed to tests/SyntaxErrorNormalizeMessageTest.php

+2
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)