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.

CommentFileSizeAuthor
#5 drupal_1938174_01.patch1.64 KBXano
#2 drupal_1938174_00.patch1.64 KBXano
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Xano’s picture

Title: WebTestBase does not properly describe how to enable modules during setUp() » Make test base class method parameters consistent
Status: Needs review » Active

Examples of the inconsistencies are:

$this->setUp('node', 'php');
$this->setUp(array('node'));

Xano’s picture

Title: Make test base class method parameters consistent » WebTestBase does not properly describe how to enable modules during setUp()
Status: Active » Needs review
FileSize
1.64 KB

Apparently 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.

clemens.tolboom’s picture

Where are calls from #1 located?

Xano’s picture

Title: Make test base class method parameters consistent » WebTestBase does not properly describe how to enable modules during setUp()
Status: Active » Needs review

Those calls no longer exist. As explained in #2 the class contained stale documentation, which is fixed by the patch (among other things).

Xano’s picture

FileSize
1.64 KB

Status: Needs review » Needs work

The last submitted patch, drupal_1938174_01.patch, failed testing.

Xano’s picture

Assigned: Xano » Unassigned

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Mile23’s picture

Issue summary: View changes
Status: Needs work » Closed (works as designed)

You 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.