Error message

You are browsing documentation for drupal 7.x, which is not supported anymore. Read the updated version of this page for drupal 11.x (the latest version).

function ModuleRequiredTestCase::testDisableRequired

Assert that core required modules cannot be disabled.

File

modules/system/system.test, line 677

Class

ModuleRequiredTestCase
Test required modules functionality.

Code

function testDisableRequired() {
 $module_info = system_get_info ('module');
 $this->drupalGet ('admin/modules');
 foreach ($module_info as $module => $info) {
 // Check to make sure the checkbox for each required module is disabled
 // and checked (or absent from the page if the module is also hidden).
 if (!empty($info['required'])) {
 $field_name = "modules[{$info['package']}][{$module}][enable]";
 if (empty($info['hidden'])) {
 $this->assertFieldByXPath ("//input[@name='{$field_name}' and @disabled='disabled' and @checked='checked']", '', format_string ('Field @name was disabled and checked.', array(
 '@name' => $field_name,
 )));
 }
 else {
 $this->assertNoFieldByName ($field_name);
 }
 }
 }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.