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.
When a test does not enable any module, then each test setUp()
adds a needless and bogus assertion:
[pass] Enabled modules: .
Comment | File | Size | Author |
---|---|---|---|
#29 | 2207377-psr4-reroll.patch | 957 bytes | xjm |
#22 | drupal8.test-modules-empty.22.patch | 1 KB | sun |
#9 | drupal8.test-modules-empty.9.patch | 1.02 KB | sun |
drupal8.test-modules-empty.0.patch | 1.03 KB | sun | |
Comments
Comment #1
sundrupal8.test-modules-empty.0.patch queued for re-testing.
Comment #2
sundrupal8.test-modules-empty.0.patch queued for re-testing.
Comment #4
sundrupal8.test-modules-empty.0.patch queued for re-testing.
Comment #5
sunComment #6
tstoecklerYup, looks great. Looked at the surrounding code and this makes a lot of sense.
In case this needs a re-roll feel free to remove the second param to enableModules() while we're at it, as that is unused. That's a pre-existing issue, though, so RTBC.
Comment #7
alexpottCommitted 3b3cb6f and pushed to 8.x. Thanks!
Comment #9
sunSorry, somehow this patch fixed the issue in my original manual testing, but I've encountered these bogus assertion messages again.
The problem is that
$modules
is actually a nested array, and it always contains a key for each class name. Only the nested values can be empty. For example:Therefore, we need to execute the
array_merge_recursive()
first, before checking whether the resulting$modules
array is empty.Comment #10
tstoecklerWhy are you removing the FALSE for $enable_dependencies flag?
Comment #11
sunHah. Quoting @tstoeckler from #6:
Indeed, DUTB::enableModules() does not expose the second argument. That is, because the modules are not actually installed; they're just added to the current module list.
Comment #12
tstoecklerepic self-#fail. :-)
Thanks for the reminder!
Comment #13
sunI'm aware that this is a follow-up patch, but I think it's just a minor annoyance, so I hope we can move forward without adding a test for this change.
Comment #14
sun9: drupal8.test-modules-empty.9.patch queued for re-testing.
Comment #15
sun9: drupal8.test-modules-empty.9.patch queued for re-testing.
Comment #16
sun9: drupal8.test-modules-empty.9.patch queued for re-testing.
Comment #17
sun9: drupal8.test-modules-empty.9.patch queued for re-testing.
Comment #18
sun9: drupal8.test-modules-empty.9.patch queued for re-testing.
Comment #19
sun9: drupal8.test-modules-empty.9.patch queued for re-testing.
Comment #20
sunBack to RTBC, I guess...
Comment #22
sunRe-rolled for
KernelTestBase
.Comment #24
sun22: drupal8.test-modules-empty.22.patch queued for re-testing.
Comment #25
sunComment #27
sun22: drupal8.test-modules-empty.22.patch queued for re-testing.
Comment #28
sunComment #29
xjmReroll for #2247991: [May 27] Move all module code from …/lib/Drupal/… to …/src/… for PSR-4.
Comment #30
alexpottCommitted c8faf22 and pushed to 8.x. Thanks!