Commit 09dd0eb9 authored by catch's avatar catch

Issue #1380958 by sun: Replace $modules list for WebTestBase::setUp() with...

Issue #1380958 by sun: Replace $modules list for WebTestBase::setUp() with ::$modules class properties.
parent 9713fab0
......@@ -13,6 +13,7 @@
* Provides common functionality for the Field UI test classes.
*/
class FieldUiTestBase extends WebTestBase {
public static $modules = array('node', 'field_ui', 'field_test', 'taxonomy');
function setUp() {
// Since this is a base class for many test cases, support the same
......@@ -23,10 +24,6 @@ function setUp() {
if (isset($modules[0]) && is_array($modules[0])) {
$modules = $modules[0];
}
$modules[] = 'node';
$modules[] = 'field_ui';
$modules[] = 'field_test';
$modules[] = 'taxonomy';
parent::setUp($modules);
// Create test user.
......
......@@ -636,12 +636,19 @@ protected function setUp() {
// Install modules needed for this test. This could have been passed in as
// either a single array argument or a variable number of string arguments.
// @todo Remove this compatibility layer in Drupal 8, and only accept
// $modules as a single array argument.
// @todo Remove this after fully converting to static $modules property.
$modules = func_get_args();
if (isset($modules[0]) && is_array($modules[0])) {
$modules = $modules[0];
}
// Collect modules to install.
$class = get_class($this);
while ($class) {
if (property_exists($class, 'modules')) {
$modules = array_merge($modules, $class::$modules);
}
$class = get_parent_class($class);
}
if ($modules) {
$success = module_enable($modules, TRUE);
$this->assertTrue($success, t('Enabled modules: %modules', array('%modules' => implode(', ', $modules))));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment