fix(tia): apply the prefix and suffix of source exclude directories (#2032)

This commit is contained in:
Lazizbek Ergashev
2026-11-18 20:29:39 +05:00
committed by GitHub
parent 9dc8c1d5cb
commit b4fcb2091e
4 changed files with 57 additions and 9 deletions
+37
View File
@@ -0,0 +1,37 @@
<?php
declare(strict_types=1);
use Pest\Plugins\Tia\SourceScope;
describe('contains()', function (): void {
it('excludes only the files matching the suffix of an excluded directory', function (): void {
$scope = new SourceScope(
['/project/src'],
[['path' => '/project/src', 'prefix' => '', 'suffix' => 'Test.php']],
);
expect($scope->contains('/project/src/Calculator.php'))->toBeTrue()
->and($scope->contains('/project/src/CalculatorTest.php'))->toBeFalse();
});
it('excludes only the files matching the prefix of an excluded directory', function (): void {
$scope = new SourceScope(
['/project/src'],
[['path' => '/project/src', 'prefix' => 'Legacy', 'suffix' => '.php']],
);
expect($scope->contains('/project/src/Calculator.php'))->toBeTrue()
->and($scope->contains('/project/src/LegacyCalculator.php'))->toBeFalse();
});
it('excludes every file of an excluded directory without a prefix or suffix', function (): void {
$scope = new SourceScope(
['/project'],
[['path' => '/project/storage/framework', 'prefix' => '', 'suffix' => '']],
);
expect($scope->contains('/project/app/Calculator.php'))->toBeTrue()
->and($scope->contains('/project/storage/framework/views/compiled.php'))->toBeFalse();
});
});