mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 15:57:21 +01:00
Merge pull request #829 from mozex/allow-pattern-in-uses
Update directory targeting logic to support glob patterns
This commit is contained in:
@ -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;
|
||||
|
||||
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
test('closure was bound to CustomTestCase', function () {
|
||||
$this->assertCustomTrue();
|
||||
});
|
||||
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
test('closure was bound to CustomTestCase', function () {
|
||||
$this->assertCustomTrue();
|
||||
});
|
||||
@ -1,9 +1,16 @@
|
||||
<?php
|
||||
|
||||
use Tests\CustomTestCase\CustomTestCase;
|
||||
use Tests\CustomTestCaseInSubFolders\SubFolder\SubFolder\CustomTestCaseInSubFolder;
|
||||
|
||||
uses(CustomTestCaseInSubFolder::class)->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
|
||||
|
||||
Reference in New Issue
Block a user