Static Source Path Matching#6398
Conversation
e6c0737 to
31dd5e9
Compare
| ], | ||
| ), | ||
| ), | ||
| ], |
There was a problem hiding this comment.
this test, that passes on main, seems more like a bug, e.g. the directory path a/c/Z** wil include a/c/PrefixSuffix.php
c9cf387 to
5107851
Compare
|
What is the status of this? Thanks. |
|
Hey, basically this is a proposal - and it should work but would need more time invested in testing, exploring the behavior and perhaps adding more test cases and as above, to consider:
|
f9c751b to
23f7b4a
Compare
8e693d6 to
2d1b2b2
Compare
|
I started working on a new library, file-filter, for this. This allows to work on this outside of PHPUnit and makes it easy to use the the functionality in both PHPUnit and php-code-coverage. Help on this new library would be much appreciated. The most obvious thing to do right now would be to add more test cases. |
that looks great!
I have to regretfully back away a bit, I've already got a number of unfinshed open-source plates spinning and I'm not sure I can add more value then what you've already provided there. But feel free to reach out with any specifics I can help with. |
This PR is a proof-of-concept for statically matching paths without traversing the filesystem during the test run. It replaces #6146 and uses the webmozarts/glob package.
Would fix #6114
The primary goal is to ensure that the source mapper needn't iterate over all included directories recursively whenever the source map is required to validate if a file belongs to the mapped files or not - for example when a deprecation is encountered PHPUnit needs to know if the deprecation was issued from source code within the project's responsiblity - i.e. source that is mapped.
We can determine if a file is within the included source by converting the glob-patterns in the
<directory>element to regexes. Currently the<directory>element in<include>and<exclude>has the attributesprefixandsuffixand we also have<file>which specifies a single file.This is more complicated than it could be:
globfunction - the implementation of which is not consistent across platforms and which has a number of rarely-used operators which while not common, would present a B/C break if they were removed.We can expect the following breaks in behavior:
globfunction and thewebmozartslibrary. Note that the behavior ofglobis also dependent onthe platform making it hard-to-impossible to lock down the behavior
completely (for reference linux man page for glob).
phpunit/php-file-iteratorwill not exactly match the results of the static matching logic.Things to consider:
phpunit/php-file-iteratorto use the same package so as to be consistent.