Mercurial > hg > isophonics-drupal-site
comparison core/modules/system/src/Tests/Module/RequiredTest.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4c8ae668cc8c |
---|---|
1 <?php | |
2 | |
3 namespace Drupal\system\Tests\Module; | |
4 | |
5 /** | |
6 * Attempt disabling of required modules. | |
7 * | |
8 * @group Module | |
9 */ | |
10 class RequiredTest extends ModuleTestBase { | |
11 /** | |
12 * Assert that core required modules cannot be disabled. | |
13 */ | |
14 public function testDisableRequired() { | |
15 $module_info = system_get_info('module'); | |
16 $this->drupalGet('admin/modules'); | |
17 foreach ($module_info as $module => $info) { | |
18 // Check to make sure the checkbox for each required module is disabled | |
19 // and checked (or absent from the page if the module is also hidden). | |
20 if (!empty($info['required'])) { | |
21 $field_name = 'modules[' . $module . '][enable]'; | |
22 if (empty($info['hidden'])) { | |
23 $this->assertFieldByXPath("//input[@name='$field_name' and @disabled='disabled' and @checked='checked']", '', format_string('Field @name was disabled and checked.', ['@name' => $field_name])); | |
24 } | |
25 else { | |
26 $this->assertNoFieldByName($field_name); | |
27 } | |
28 } | |
29 } | |
30 } | |
31 | |
32 } |