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.
As seen in #3084611: prepareDirectory vs file_prepare_directory breaks with core <8.7, otherwise build succeeds but testbot coughs.
Comment | File | Size | Author |
---|---|---|---|
#6 | interdiff_2-6.txt | 4.82 KB | philltran |
#6 | add-a-test-3085280-6.patch | 2.17 KB | philltran |
|
Comments
Comment #2
philltran CreditAttribution: philltran at Symmetri Technology commentedHere is a patch with a simple test, so the testbot lets us pass.
Comment #3
gregglesThanks so much! I'm not super familiar with unit tests, so I'll defer to others to review.
Comment #4
Mile23Looks pretty good, but...
If you find yourself doing a lot of mocking of services, you should probably convert to a KernelTestBase test. That will do a lot of the work for you in terms of setting up services and loading modules (but not enabling them).
Comment #5
philltran CreditAttribution: philltran at Symmetri Technology commentedThanks Mile23. I will refactor as a kernel test .
Comment #6
philltran CreditAttribution: philltran at Symmetri Technology commentedHere is a patch with the test re-written as a kernel test instead of a unit test.
Please review. Thanks!
Comment #7
gregglesThat's indeed a lot simpler. Thanks for posting it.
Comment #8
philltran CreditAttribution: philltran commentedYou are welcome!
Comment #9
greggles@mile23 can you review again? Does this seem good to you?
Comment #10
neclimdulI disagree on the service mocking argument because if there are interfaces mock away and you can better assert your excepted behaviors with fewer complications.
That said, the config and file system complications make this better suited for the kernel test. LGTM.
Comment #12
gregglesThanks for the reviews, neclimdul and mile23, and for the patch here, philltran.
Comment #13
philltran CreditAttribution: philltran commentedThanks neclimdul and mile23 for reviewing and for the pointers.