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