Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
In build tests, you can provide an iterator for copyCodebase().
If none is provided, BuildTestBase uses a symfony Finder object to generate an iterator. It creates the finder object internally, so you can't just add extra filters on the finder, you have to create a whole different one.
This makes it difficult to remain consistent in what copyCodebase() will copy, because everyone has to re-invent this particular wheel.
Proposed resolution
Add a factory method to BuildTestBase which makes the finder object. This allows test authors to use the same finder constraints that copyCodebase() would, but also add their own.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#5 | interdiff.txt | 959 bytes | Mile23 |
#5 | 3095809_5.patch | 2.05 KB | Mile23 |
#2 | 3095809_2.patch | 1.73 KB | Mile23 |
Comments
Comment #2
Mile23A patch.
You can see the use case here: https://github.com/paul-m/drupal/blob/3047468/core/tests/Drupal/BuildTes...
Comment #3
joachim CreditAttribution: joachim commentedJust a nitpick:
Missing return description.
Otherwise, looks good, and makes sense to allow this to be tweaked / overridden in test classes.
Comment #4
heddn+1 from me. Just needs some nits fixed up from per #3.
Comment #5
Mile23Thanks.
Added some clarifying documentation including @return annotation.
Comment #6
joachim CreditAttribution: joachim as a volunteer commentedLGTM!
Comment #7
alexpottCommitted and pushed cd1325c397 to 9.0.x and 384187f418 to 8.9.x and 7ddd396c07 to 8.8.x. Thanks!
Backported to 8.8.x as a test-only fix.