diff --git a/src/PendingCalls/UsesCall.php b/src/PendingCalls/UsesCall.php index fc297698..eabd5de9 100644 --- a/src/PendingCalls/UsesCall.php +++ b/src/PendingCalls/UsesCall.php @@ -84,8 +84,10 @@ final class UsesCall }, $targets); $this->targets = array_reduce($targets, function (array $accumulator, string $target): array { - if (is_dir($target) || file_exists($target)) { - $accumulator[] = (string) realpath($target); + if (($matches = glob($target)) !== false) { + foreach ($matches as $file) { + $accumulator[] = (string) realpath($file); + } } return $accumulator; diff --git a/tests/PHPUnit/GlobPatternTests/SubFolder/InnerFolder/UsesPerDirectoryAsPattern.php b/tests/PHPUnit/GlobPatternTests/SubFolder/InnerFolder/UsesPerDirectoryAsPattern.php new file mode 100644 index 00000000..196fea3a --- /dev/null +++ b/tests/PHPUnit/GlobPatternTests/SubFolder/InnerFolder/UsesPerDirectoryAsPattern.php @@ -0,0 +1,5 @@ +assertCustomTrue(); +}); diff --git a/tests/PHPUnit/GlobPatternTests/SubFolder2/UsesPerFileAsPattern.php b/tests/PHPUnit/GlobPatternTests/SubFolder2/UsesPerFileAsPattern.php new file mode 100644 index 00000000..196fea3a --- /dev/null +++ b/tests/PHPUnit/GlobPatternTests/SubFolder2/UsesPerFileAsPattern.php @@ -0,0 +1,5 @@ +assertCustomTrue(); +}); diff --git a/tests/Pest.php b/tests/Pest.php index 23daca74..5105219b 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -1,9 +1,16 @@ in('PHPUnit/CustomTestCaseInSubFolders/SubFolder/SubFolder'); +// test case for all the directories inside PHPUnit/GlobPatternTests/SubFolder/ +uses(CustomTestCase::class)->in('PHPUnit/GlobPatternTests/SubFolder/*/'); + +// test case for all the files that end with AsPattern.php inside PHPUnit/GlobPatternTests/SubFolder2/ +uses(CustomTestCase::class)->in('PHPUnit/GlobPatternTests/SubFolder2/*AsPattern.php'); + uses()->group('integration')->in('Visual'); // NOTE: global test value container to be mutated and checked across files, as needed