diff --git a/extension.neon b/extension.neon index f0f672d..7da6c15 100644 --- a/extension.neon +++ b/extension.neon @@ -3,6 +3,8 @@ parameters: - PHPUnit\Framework\TestCase scanDirectories: - src + stubFiles: + - stubs/DescribeCall.stub services: - diff --git a/src/Type/Pest/PestInternalClassAccessIgnoreExtension.php b/src/Type/Pest/PestInternalClassAccessIgnoreExtension.php index c51fc2a..339179d 100644 --- a/src/Type/Pest/PestInternalClassAccessIgnoreExtension.php +++ b/src/Type/Pest/PestInternalClassAccessIgnoreExtension.php @@ -17,6 +17,7 @@ final class PestInternalClassAccessIgnoreExtension implements IgnoreErrorExtensi 'property.internalClass', 'method.internalClass', 'method.internalTrait', + 'method.internalInterface', ]; public function shouldIgnore(Error $error, Node $node, Scope $scope): bool diff --git a/stubs/DescribeCall.stub b/stubs/DescribeCall.stub new file mode 100644 index 0000000..4a079bb --- /dev/null +++ b/stubs/DescribeCall.stub @@ -0,0 +1,12 @@ +analyse([ + __DIR__.'/data/describe-call-methods.php', + ], []); +}); diff --git a/tests/Rules/PestInternalClassAccessIgnoreExtensionTest.php b/tests/Rules/PestInternalClassAccessIgnoreExtensionTest.php new file mode 100644 index 0000000..35f6a12 --- /dev/null +++ b/tests/Rules/PestInternalClassAccessIgnoreExtensionTest.php @@ -0,0 +1,21 @@ +analyse([ + __DIR__.'/data/arch-expectation-internal-methods.php', + ], []); +}); diff --git a/tests/Rules/data/arch-expectation-internal-methods.php b/tests/Rules/data/arch-expectation-internal-methods.php new file mode 100644 index 0000000..2503521 --- /dev/null +++ b/tests/Rules/data/arch-expectation-internal-methods.php @@ -0,0 +1,17 @@ +expect('App\Models') + ->toBeClasses() + ->toExtend('Illuminate\Database\Eloquent\Model') + ->toOnlyBeUsedIn('App\Repositories') + ->ignoring('App\Models\User'); +}); + +test('arch expectation ignoring global functions is allowed', function (): void { + arch()->expect('App\Services') + ->toUseNothing() + ->ignoringGlobalFunctions(); +}); diff --git a/tests/Rules/data/describe-call-methods.php b/tests/Rules/data/describe-call-methods.php new file mode 100644 index 0000000..976dffd --- /dev/null +++ b/tests/Rules/data/describe-call-methods.php @@ -0,0 +1,29 @@ +toBeTrue(); + }); +})->skip(); + +describe('user settings', function (): void { + test('receives the dataset value', function (int $value): void { + expect($value)->toBeGreaterThan(0); + }); +})->with([10, 20]); + +describe('auth', function (): void { + beforeEach(fn () => null); + + test('can logout', function (): void { + expect(true)->toBeTrue(); + }); +})->skip(fn (): bool => true, 'only runs on sqlite')->with([10, 20])->group('slow'); + +describe('teardown', function (): void { + test('example', function (): void { + expect(true)->toBeTrue(); + }); +})->after(function (): void {}); diff --git a/tests/Rules/internal-tag.neon b/tests/Rules/internal-tag.neon new file mode 100644 index 0000000..c40ef19 --- /dev/null +++ b/tests/Rules/internal-tag.neon @@ -0,0 +1,5 @@ +includes: + - ../extension.neon +parameters: + featureToggles: + internalTag: true