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.
A lot of test case methods accepts parameters of mixed types, such as setUp(), which accepts either one array of strings, or multiple string arguments. This is bad, because:
- it requires extra lines of code to preprocess the parameters
- child classes require extra lines of code to preprocess their parameters and pass them on
- some editors may not be able to provide proper code completion when parameters are not or unclearly documented
Solution: require such methods to accept a single array parameter only.
Comment | File | Size | Author |
---|---|---|---|
#5 | drupal_1938174_01.patch | 1.64 KB | Xano |
#2 | drupal_1938174_00.patch | 1.64 KB | Xano |
Comments
Comment #1
XanoExamples of the inconsistencies are:Comment #2
XanoApparently this was no longer possible, but the documentation still said it was. The patch updates the documentation, and also declares and documents the undocumented WebTestBase::modules property.
Comment #3
clemens.tolboomWhere are calls from #1 located?
Comment #4
XanoThose calls no longer exist. As explained in #2 the class contained stale documentation, which is fixed by the patch (among other things).
Comment #5
XanoComment #7
XanoComment #11
Mile23You can see the current docblock for WebTestBase::setUp() here: https://api.drupal.org/api/drupal/core%21modules%21simpletest%21src%21We...
It doesn't seem to mention passing in parameters.
It does say how to set up ::modules and ::profile, and of course the full documentation is on FunctionalTestSetupTrait::installModulesFromClassProperty here: https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Test%21Fu...
Closing this as works, but please re-open if there's another issue.