-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Static Source Path Matching #6398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Static Source Path Matching #6398
Conversation
e6c0737 to
31dd5e9
Compare
| ], | ||
| ), | ||
| ), | ||
| ], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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:
|
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.