#1380958: Replace $modules list for WebTestBase::setUp() with ::$modules class properties changed how tests declare which modules they depend on. See the change record.

First, assign the issue to yourself, both on the issue and by editing your name into this issue summary table.

For each test class:

  1. Find the setUp() method.
  2. If it passes parent::setUp() an array of modules, add the following at the top of the class, above any other methods or properties:
    class FooBase extends WebTestBase {
    
      /**
       * Modules to enable.
       *
       * @var array
       */
      public static $modules = array();
    

    Make sure there is a blank line between the class declaration and the docblock.

  3. Note which modules are passed to parent::setUp(), and move them to the $modules array above. Do not remove parent::setUp(); just remove its parameters.
  4. Move any documentation about the enabled modules (in either an inline comment or a docblock) to the docblock for $modules instead.
  5. If the setUp() method is empty except for this line, remove it completely.

You can use this bash command to find relevant setUp() methods: grep -nr "parent::setUp([^)]" *

Module/Directory Assigned Issue link
profiles directory tim.plunkett #1711436: Convert testing profile tests to use ::$modules property instead of parent::setUp($modules)
aggregator module kid_icarus #1711274: Convert aggregator tests to use ::$modules property instead of parent::setUp($modules)
block module kid_icarus #1711286: Convert block tests to use ::$modules property instead of parent::setUp($modules)
book module kid_icarus #1711290: Convert book tests to use ::$modules property instead of parent::setUp($modules)
color module kid_icarus #1711296: Convert color tests to use ::$modules property instead of parent::setUp($modules)
comment module kid_icarus #1711298: Convert comment tests to use ::$modules property instead of parent::setUp($modules)
config module kid_icarus #1711304: Convert config tests to use ::$modules property instead of parent::setUp($modules)
contact module kid_icarus #1711306: Convert contact tests to use ::$modules property instead of parent::setUp($modules)
contextual module kid_icarus #1711308: Convert contextual tests to use ::$modules property instead of parent::setUp($modules)
dblog module kid_icarus #1711310: Convert dblog tests to use ::$modules property instead of parent::setUp($modules)
entity module kid_icarus #1711312: Convert entity tests to use ::$modules property instead of parent::setUp($modules)
field module kid_icarus #1711316: Convert field tests to use ::$modules property instead of parent::setUp($modules)
field_ui module kid_icarus #1711314: Convert field_ui tests to use ::$modules property instead of parent::setUp($modules)
file module zendoodles #1711344: Convert file tests to use ::$modules property instead of parent::setUp($modules)
filter module kid_icarus #1711346: Convert filter tests to use ::$modules property instead of parent::setUp($modules)
forum module kid_icarus #1711348: Convert forum tests to use ::$modules property instead of parent::setUp($modules)
help module kid_icarus #1711350: Convert help tests to use ::$modules property instead of parent::setUp($modules)
image module zendoodles #1711352: Convert image tests to use ::$modules property instead of parent::setUp($modules)
language module tim.plunkett #1711356: Convert language tests to use ::$modules property instead of parent::setUp($modules)
locale module cam8001 #1711394: Convert locale tests to use ::$modules property instead of parent::setUp($modules)
menu module zendoodles #1711396: Convert menu tests to use ::$modules property instead of parent::setUp($modules)
node module tim.plunkett #1710300: Convert node tests to use ::$modules property instead of parent::setUp($modules)
openid module tim.plunkett #1711398: Convert openid tests to use ::$modules property instead of parent::setUp($modules)
overlay module N/A N/A
path module kid_icarus #1711400: Convert path tests to use ::$modules property instead of parent::setUp($modules)
php module kid_icarus #1711402: Convert php tests to use ::$modules property instead of parent::setUp($modules)
poll module kid_icarus #1711404: Convert poll tests to use ::$modules property instead of parent::setUp($modules)
rdf module kid_icarus #1711408: Convert rdf tests to use ::$modules property instead of parent::setUp($modules)
search module xjm #1711418: Convert search tests to use ::$modules property instead of parent::setUp($modules)
shortcut module droplet #1711410: Convert shortcut tests to use ::$modules property instead of parent::setUp($modules)
simpletest module tim.plunkett #1711412: Convert simpletest tests to use ::$modules property instead of parent::setUp($modules)
statistics module droplet #1711414: Convert statistics tests to use ::$modules property instead of parent::setUp($modules)
syslog module kid_icarus #1711416: Convert syslog tests to use ::$modules property instead of parent::setUp($modules)
system module cam8001 #1711424: Convert system tests to use ::$modules property instead of parent::setUp($modules)
taxonomy module xjm #1711426: Convert taxonomy tests to use ::$modules property instead of parent::setUp($modules)
toolbar module N/A N/A
tracker module tim.plunkett #1711428: Convert tracker tests to use ::$modules property instead of parent::setUp($modules)
translation module droplet #1711430: Convert translation tests to use ::$modules property instead of parent::setUp($modules)
update module droplet #1711432: Convert update tests to use ::$modules property instead of parent::setUp($modules)
user module tim.plunkett #1711434: Convert user tests to use ::$modules property instead of parent::setUp($modules)
xmlrpc module droplet #1711440: Convert xmlrpc tests to use ::$modules property instead of parent::setUp($modules)

Once all those are done, commit #1711076: Remove setUp as a means of enabling modules

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tim.plunkett’s picture

Issue summary: View changes

put ol around steps

sun’s picture

Title: [meta] Convert tests to use ::$modules instead of ::setUp($modules) » [meta] Convert tests to use ::$modules property instead of parent::setUp($modules)
Issue tags: +Novice, +Testing system

Thanks! Slightly adjusting title and tagging.

sun’s picture

Issue summary: View changes

added #1711076

tim.plunkett’s picture

Issue summary: View changes

Updated issue summary.

tim.plunkett’s picture

Issue summary: View changes

Updated issue summary.

tim.plunkett’s picture

Issue summary: View changes

Updated issue summary.

tim.plunkett’s picture

Issue summary: View changes

Updated issue summary.

tim.plunkett’s picture

Issue summary: View changes

Updated issue summary.

tim.plunkett’s picture

Issue summary: View changes

Updated issue summary.

tim.plunkett’s picture

Issue summary: View changes

Updated issue summary.

tim.plunkett’s picture

Issue summary: View changes

Updated issue summary.

tim.plunkett’s picture

Issue summary: View changes

Updated issue summary.

tim.plunkett’s picture

Issue summary: View changes

Updated issue summary.

xjm’s picture

Issue summary: View changes

.

xjm’s picture

Issue summary: View changes

Updated issue summary.

tim.plunkett’s picture

Issue summary: View changes

Updated issue summary.

tim.plunkett’s picture

Issue summary: View changes

added kid_icarus

tim.plunkett’s picture

Issue summary: View changes

added instruction about assigning

tim.plunkett’s picture

Issue summary: View changes

Updated issue summary.

tim.plunkett’s picture

Issue summary: View changes

Updated issue summary.

kid_icarus’s picture

Issue summary: View changes

Added kid_icarus to comment module

kid_icarus’s picture

Issue summary: View changes

Added kid_icarus to config module

kid_icarus’s picture

Issue summary: View changes

Added kid_icarus to contact module

kid_icarus’s picture

Issue summary: View changes

Added kid_icarus to contextual module

kid_icarus’s picture

Issue summary: View changes

Added kid_icarus to entity module

kid_icarus’s picture

Issue summary: View changes

Added kid_icarus to field module

kid_icarus’s picture

Issue summary: View changes

Added kid_icarus to field_ui module

tim.plunkett’s picture

Issue summary: View changes

Updated issue summary.

kid_icarus’s picture

Issue summary: View changes

Added kid_icarus to filter module

kid_icarus’s picture

Issue summary: View changes

Added kid_icarus to forum module

kid_icarus’s picture

Issue summary: View changes

Added kid_icarus to help module

kid_icarus’s picture

Issue summary: View changes

Added kid_icarus to php module

xjm’s picture

Issue summary: View changes

Updated issue summary.

xjm’s picture

Issue summary: View changes

Updated issue summary.

xjm’s picture

Updated the summary with instructions that conform to our coding standards from http://drupal.org/node/1354#classes.

xjm’s picture

Issue summary: View changes

Updated issue summary.

ZenDoodles’s picture

Issue summary: View changes

Updated issue summary.

xjm’s picture

Issue summary: View changes

.

Cameron Tod’s picture

Issue summary: View changes

Assigned myself to the locale module.

xjm’s picture

Issue summary: View changes

Updated issue summary.

xjm’s picture

Issue summary: View changes

Updated issue summary.

tim.plunkett’s picture

Issue summary: View changes

Updated issue summary.

tim.plunkett’s picture

Issue summary: View changes

Updated issue summary.

tim.plunkett’s picture

Issue summary: View changes

Updated issue summary.

tim.plunkett’s picture

Issue summary: View changes

Updated issue summary.

xjm’s picture

Issue summary: View changes

Updated issue summary.

Cameron Tod’s picture

Issue summary: View changes

Assigned myself to system.module.

webchick’s picture

Is there any way we could get just one mega-patch with all of these? This is currently clobbering the RTBC queue with 500 issues that are each going to take 1-2 minutes to process.

Cameron Tod’s picture

Should we wait till they are all RTBC individually, then roll the patches up together?

kid_icarus’s picture

Issue summary: View changes

Assigned kid_icarus to path module

tim.plunkett’s picture

FileSize
259.08 KB

All but three of the issues were RTBC, and I personally reviewed and finished those.

Here's the whole thing.

tim.plunkett’s picture

Title: [meta] Convert tests to use ::$modules property instead of parent::setUp($modules) » Convert tests to use ::$modules property instead of parent::setUp($modules)
Assigned: Unassigned » tim.plunkett
Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, drupal-1711070-5.patch, failed testing.

tim.plunkett’s picture

Status: Needs work » Needs review
FileSize
259.19 KB
tim.plunkett’s picture

I also need to roll in #1711076: Remove setUp as a means of enabling modules, waiting for the bot in case I need to clean anything else up.

tim.plunkett’s picture

FileSize
260.12 KB

This should be the final patch.

Since this was split over many issues, here is the list of people to give credit to:

kid_icarus, tim.plunkett, xjm, droplet, zendoodles and cam8001

Status: Needs review » Needs work

The last submitted patch, drupal-1711070-10.patch, failed testing.

tim.plunkett’s picture

Status: Needs work » Needs review
FileSize
260.25 KB

Forgot to instantiate $modules in WebTestBase.

Status: Needs review » Needs work

The last submitted patch, drupal-1711070-12.patch, failed testing.

tim.plunkett’s picture

Status: Needs work » Needs review
FileSize
1.37 KB
261.62 KB

My grep search failed! Adjusted to grep -nr "::setUp([^)]" * and caught another one.

CommentNodeAccessTest was doing some weird stuff in avoiding CommentTestBase, I cleaned that up.

tim.plunkett’s picture

One more reminder for committers!
This is the list of those who worked on the individual issues:

kid_icarus, tim.plunkett, xjm, droplet, zendoodles and cam8001

webchick’s picture

Status: Needs review » Fixed

I did a quick check of the avoid commit conflicts tag and only found two open issues, one for D7 and the other that's NW.

Committed and pushed to 8.x. Thanks a bunch!

The change notice was already covered in the other issue, so this should be able to be just fixed.

Automatically closed -- issue fixed for 2 weeks with no activity.