diff --git a/composer.json b/composer.json index 51ad669..b86fdc5 100644 --- a/composer.json +++ b/composer.json @@ -38,8 +38,8 @@ }, "scripts": { "lint": "vendor/bin/parallel-lint --colors src/ tests/", - "lint-7.x": "vendor/bin/parallel-lint --colors src/ tests/ --exclude tests/libs/TypesEverywhere.php --exclude tests/src/disallowed/functionCallsNamedParams.php --exclude tests/src/disallowed-allow/functionCallsNamedParams.php --exclude tests/src/disallowed/attributeUsages.php --exclude tests/src/disallowed-allow/attributeUsages.php", - "lint-8.0": "vendor/bin/parallel-lint --colors src/ tests/ --exclude tests/libs/TypesEverywhere.php", + "lint-7.x": "vendor/bin/parallel-lint --colors src/ tests/ --exclude tests/src/TypesEverywhere.php --exclude tests/src/disallowed/functionCallsNamedParams.php --exclude tests/src/disallowed-allow/functionCallsNamedParams.php --exclude tests/src/disallowed/attributeUsages.php --exclude tests/src/disallowed-allow/attributeUsages.php", + "lint-8.0": "vendor/bin/parallel-lint --colors src/ tests/ --exclude tests/src/TypesEverywhere.php", "lint-neon": "vendor/bin/neon-lint .", "phpcs": "vendor/bin/phpcs src/ tests/", "cs-fix": "vendor/bin/phpcbf src/ tests/", diff --git a/tests/Calls/FunctionCallsInMultipleNamespacesTest.php b/tests/Calls/FunctionCallsInMultipleNamespacesTest.php index 6998ef5..7a369d8 100644 --- a/tests/Calls/FunctionCallsInMultipleNamespacesTest.php +++ b/tests/Calls/FunctionCallsInMultipleNamespacesTest.php @@ -52,36 +52,36 @@ protected function getRule(): Rule public function testRule(): void { // Based on the configuration above, in this file: - $this->analyse([__DIR__ . '/../libs/FunctionInMultipleNamespaces.php'], [ + $this->analyse([__DIR__ . '/../src/FunctionInMultipleNamespaces.php'], [ [ // expect this error message: 'Calling __() (as alias()) is forbidden, use MyNamespace\__ instead', // on this line: - 18, + 20, ], [ 'Calling MyNamespace\__() (as __()) is forbidden, ha ha ha nope', - 23, + 26, ], [ 'Calling printf() is forbidden, because reasons', - 26, + 30, ], [ 'Calling printf() is forbidden, because reasons', - 27, + 31, ], [ 'Calling MyNamespace\__() (as alias()) is forbidden, ha ha ha nope', - 35, + 39, ], [ 'Calling printf() is forbidden, because reasons', - 36, + 40, ], [ 'Calling printf() is forbidden, because reasons', - 37, + 41, ], ]); } diff --git a/tests/Usages/AttributeUsagesAllowParamsMultipleTest.php b/tests/Usages/AttributeUsagesAllowParamsMultipleTest.php index 60723f4..535f2a9 100644 --- a/tests/Usages/AttributeUsagesAllowParamsMultipleTest.php +++ b/tests/Usages/AttributeUsagesAllowParamsMultipleTest.php @@ -33,7 +33,7 @@ protected function getRule(): Rule AttributeEntity::class, ], 'allowIn' => [ - '../libs/ClassWithAttributesAllow.php', + '../src/disallowed-allow/ClassWithAttributesAllow.php', ], 'allowParamsAnywhereAnyValue' => [ [ @@ -57,26 +57,26 @@ protected function getRule(): Rule public function testRule(): void { // Based on the configuration above, in this file: - $this->analyse([__DIR__ . '/../libs/ClassWithAttributes.php'], [ + $this->analyse([__DIR__ . '/../src/disallowed/ClassWithAttributes.php'], [ [ // expect this error message: 'Attribute Attributes\AttributeEntity is forbidden, because reasons', // on this line: - 10, + 8, ], ]); - $this->analyse([__DIR__ . '/../libs/ClassWithAttributesAllow.php'], [ + $this->analyse([__DIR__ . '/../src/disallowed-allow/ClassWithAttributesAllow.php'], [ [ 'Attribute Attributes\AttributeEntity is forbidden, because reasons', - 10, + 8, ], [ 'Attribute Attributes\AttributeEntity is forbidden, because reasons', - 15, + 12, ], [ 'Attribute Attributes\AttributeEntity is forbidden, because reasons', - 22, + 18, ], ]); } diff --git a/tests/Usages/AttributeUsagesTest.php b/tests/Usages/AttributeUsagesTest.php index 148f3b3..c894a8d 100644 --- a/tests/Usages/AttributeUsagesTest.php +++ b/tests/Usages/AttributeUsagesTest.php @@ -31,7 +31,7 @@ protected function getRule(): Rule AttributeEntity::class, ], 'allowIn' => [ - '../libs/ClassWithAttributesAllow.php', + '../src/disallowed-allow/ClassWithAttributesAllow.php', ], 'allowParamsAnywhereAnyValue' => [ [ @@ -48,15 +48,15 @@ protected function getRule(): Rule public function testRule(): void { // Based on the configuration above, in this file: - $this->analyse([__DIR__ . '/../libs/ClassWithAttributes.php'], [ + $this->analyse([__DIR__ . '/../src/disallowed/ClassWithAttributes.php'], [ [ // expect this error message: 'Attribute Attributes\AttributeEntity is forbidden, because reasons', // on this line: - 10, + 8, ], ]); - $this->analyse([__DIR__ . '/../libs/ClassWithAttributesAllow.php'], []); + $this->analyse([__DIR__ . '/../src/disallowed-allow/ClassWithAttributesAllow.php'], []); } } diff --git a/tests/Usages/NamespaceUsagesTypesTest.php b/tests/Usages/NamespaceUsagesTypesTest.php index b6ebf59..6dc5590 100644 --- a/tests/Usages/NamespaceUsagesTypesTest.php +++ b/tests/Usages/NamespaceUsagesTypesTest.php @@ -39,7 +39,7 @@ protected function getRule(): Rule public function testRule(): void { // Based on the configuration above, in this file: - $this->analyse([__DIR__ . '/../libs/TypesEverywhere.php'], [ + $this->analyse([__DIR__ . '/../src/TypesEverywhere.php'], [ [ // expect this error message: 'Namespace Waldo\Quux\Blade is forbidden, do androids dream of electric sheep?', diff --git a/tests/bootstrap.php b/tests/bootstrap.php index c4d73df..ab9df8b 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -2,13 +2,10 @@ declare(strict_types = 1); require_once __DIR__ . '/../vendor/autoload.php'; -require_once __DIR__ . '/libs/Bar.php'; -require_once __DIR__ . '/libs/Blade.php'; -require_once __DIR__ . '/libs/Constructor.php'; -require_once __DIR__ . '/libs/Functions.php'; -require_once __DIR__ . '/libs/Inheritance.php'; -require_once __DIR__ . '/libs/Royale.php'; -require_once __DIR__ . '/libs/SomeInterface.php'; -require_once __DIR__ . '/libs/Option.php'; -require_once __DIR__ . '/libs/TestTrait.php'; -require_once __DIR__ . '/libs/Traits.php'; + +$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(__DIR__ . '/libs', FilesystemIterator::SKIP_DOTS)); +foreach ($iterator as $fileInfo) { + if ($fileInfo->getExtension() === 'php') { + require_once $fileInfo->getPathname(); + } +} diff --git a/tests/libs/ClassWithAttributes.php b/tests/libs/ClassWithAttributes.php deleted file mode 100644 index 77bcf4c..0000000 --- a/tests/libs/ClassWithAttributes.php +++ /dev/null @@ -1,34 +0,0 @@ -