generate:travis-yml command sometimes fails to detect tests in plugin #6532
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
generate:travis-yml
was looking for test files in plugins, but it was looking intests/*Test.php
ortests/*/*Test.php
. And of course, for plugins that had plugins in a 3 level deep subdirectory (i.e.tests/*/*/*Test.php
) the command was failing because no tests were found. This is the case for example for the ActivityLog plugin.I could have fixed it by adding another test to the list (because
glob()
doesn't match recursively):But this is not really ideal, so instead of writing useless complex code I went with using Symfony's Finder component:
So that's the reason I'm opening a pull request: do you think that's fine to introduce a new dependency to that component? I've been using the Finder for a while in other projects and it's really useful, I'm guessing it could be reused in many places in Piwik.