Change record status: 
Project: 
Introduced in branch: 
8.x
Description: 

In Drupal 7, a list of modules could be passed to the setUp() method of a simpletest automated test to enable those modules in the test methods. Instead in Drupal 8, a public static class property is used.

Sometimes the setUp method was only used to enable modules. In those cases, it can be removed entirely.

Drupal 7

<?php
class NodeLoadHooksTestCase extends DrupalWebTestCase {
  function
setUp() {
   
parent::setUp('node_test');
  }

 
// ...
}
?>

Drupal 8

<?php
class NodeLoadHooksTest extends NodeTestBase {
  public static
$modules = array('node_test');

 
// ...
}
?>

In other cases, setUp() was used for other things as well. In these cases, continue to call parent::setUp(), but pass no arguments.

Drupal 7

<?php
class NodeCreationTestCase extends DrupalWebTestCase {
  function
setUp() {
   
parent::setUp('node_test_exception');

   
$web_user = $this->drupalCreateUser(array('create page content', 'edit own page content'));
   
$this->drupalLogin($web_user);
  }

 
// ...
}
?>

Drupal 8

<?php
class NodeCreationTest extends NodeTestBase {

 
/**
   * Modules to enable.
   *
   * @var array
   */
 
public static $modules = array('node_test_exception');

  function
setUp() {
   
parent::setUp();

   
$web_user = $this->drupalCreateUser(array('create page content', 'edit own page content'));
   
$this->drupalLogin($web_user);
  }

 
// ...
}
?>
Impacts: 
Module developers
Updates Done (doc team, etc.)
Online documentation: 
Not done
Theming guide: 
Not done
Module developer documentation: 
Not done
Examples project: 
Not done
Coder Review: 
Not done
Coder Upgrade: 
Not done
Other: 
Other updates done