Description
Summary
Currently, glob are supported, but only using the default glob
php function, which is quite limited. The default glob function doesn't allow for the usage of "globstar", which is a pretty common practice when targeting files using glob patterns.
Problem
Without globstar, we are limited to a single level of "unspecified" directory, when using filter in libraries such as phpunit. Take the following structure as example.
root_directory
├── directory_1
│ └── target_directory
└── directory_2
└── directory_2_1
└── directory_2_1_1
└── target_directory
Using the current implementation of the Factory::resolveWildcards
function, we can use the following pattern to target the directory target_directory
right under directory_1
:
root_directory/*/target_directory
However, it is not possible to target the target_directory
under directory_2_2_1
, since the glob pattern is only looking at the first level. It basically translates to root_directory/{any directory}/target_directory
.
This means we need to pass multiple patterns to the filter in order to target all target_directory
.
root_directory/*/target_directory
root_directory/*/*/*/target_directory
...
This solution is problematic when the directory structure changes a lot, which is pretty common when building complex projects.
Solution.
There are a few solutions, online, to extend the glob
function behaviour to include globstar. One such solution can be found here..
I tried to implements this particular solution and it seams to be working fine in my local environment.
I will try to submit a PR that could fix the issue.