Issue #2665152 by alexpott, Andrej Galuf, tfranz, longwave, jsimonis, andypost, bojanz: Certain modules can't be enabled when Suhosin is used
parent
41c4f2e02c
commit
7f37114aca
|
@ -208,12 +208,12 @@ class CommentFieldsTest extends CommentTestBase {
|
|||
|
||||
// Install core content type module (book).
|
||||
$edit = array();
|
||||
$edit['modules[Core][book][enable]'] = 'book';
|
||||
$edit['book[enable]'] = 'book';
|
||||
$this->drupalPostForm('admin/modules', $edit, t('Install'));
|
||||
|
||||
// Now install the comment module.
|
||||
$edit = array();
|
||||
$edit['modules[Core][comment][enable]'] = 'comment';
|
||||
$edit['comment[enable]'] = 'comment';
|
||||
$this->drupalPostForm('admin/modules', $edit, t('Install'));
|
||||
$this->rebuildContainer();
|
||||
$this->assertTrue($this->container->get('module_handler')->moduleExists('comment'), 'Comment module enabled.');
|
||||
|
|
|
@ -122,7 +122,7 @@ class ConfigInstallWebTest extends WebTestBase {
|
|||
// will install the config_test module first because it is a dependency of
|
||||
// config_install_fail_test.
|
||||
// @see \Drupal\system\Form\ModulesListForm::submitForm()
|
||||
$this->drupalPostForm('admin/modules', array('modules[Testing][config_test][enable]' => TRUE, 'modules[Testing][config_install_fail_test][enable]' => TRUE), t('Install'));
|
||||
$this->drupalPostForm('admin/modules', array('config_test[enable]' => TRUE, 'config_install_fail_test[enable]' => TRUE), t('Install'));
|
||||
$this->assertRaw('Unable to install Configuration install fail test, <em class="placeholder">config_test.dynamic.dotted.default</em> already exists in active configuration.');
|
||||
|
||||
// Uninstall the config_test module to test the confirm form.
|
||||
|
@ -133,7 +133,7 @@ class ConfigInstallWebTest extends WebTestBase {
|
|||
// The user is shown a confirm form because the config_test module is a
|
||||
// dependency.
|
||||
// @see \Drupal\system\Form\ModulesListConfirmForm::submitForm()
|
||||
$this->drupalPostForm('admin/modules', array('modules[Testing][config_install_fail_test][enable]' => TRUE), t('Install'));
|
||||
$this->drupalPostForm('admin/modules', array('config_install_fail_test[enable]' => TRUE), t('Install'));
|
||||
$this->drupalPostForm(NULL, array(), t('Continue'));
|
||||
$this->assertRaw('Unable to install Configuration install fail test, <em class="placeholder">config_test.dynamic.dotted.default</em> already exists in active configuration.');
|
||||
|
||||
|
@ -147,7 +147,7 @@ class ConfigInstallWebTest extends WebTestBase {
|
|||
->set('label', 'Je suis Charlie')
|
||||
->save();
|
||||
|
||||
$this->drupalPostForm('admin/modules', array('modules[Testing][config_install_fail_test][enable]' => TRUE), t('Install'));
|
||||
$this->drupalPostForm('admin/modules', array('config_install_fail_test[enable]' => TRUE), t('Install'));
|
||||
$this->assertRaw('Unable to install Configuration install fail test, <em class="placeholder">config_test.dynamic.dotted.default, language/fr/config_test.dynamic.dotted.default</em> already exist in active configuration.');
|
||||
|
||||
// Test installing a theme through the UI that has existing configuration.
|
||||
|
@ -178,16 +178,16 @@ class ConfigInstallWebTest extends WebTestBase {
|
|||
$this->drupalLogin($this->adminUser);
|
||||
// We need to install separately since config_install_dependency_test does
|
||||
// not depend on config_test and order is important.
|
||||
$this->drupalPostForm('admin/modules', array('modules[Testing][config_test][enable]' => TRUE), t('Install'));
|
||||
$this->drupalPostForm('admin/modules', array('modules[Testing][config_install_dependency_test][enable]' => TRUE), t('Install'));
|
||||
$this->drupalPostForm('admin/modules', array('config_test[enable]' => TRUE), t('Install'));
|
||||
$this->drupalPostForm('admin/modules', array('config_install_dependency_test[enable]' => TRUE), t('Install'));
|
||||
$this->assertRaw('Unable to install <em class="placeholder">Config install dependency test</em> due to unmet dependencies: <em class="placeholder">config_test.dynamic.other_module_test_with_dependency (config_other_module_config_test, config_test.dynamic.dotted.english)</em>');
|
||||
|
||||
$this->drupalPostForm('admin/modules', array('modules[Testing][config_test_language][enable]' => TRUE), t('Install'));
|
||||
$this->drupalPostForm('admin/modules', array('modules[Testing][config_install_dependency_test][enable]' => TRUE), t('Install'));
|
||||
$this->drupalPostForm('admin/modules', array('config_test_language[enable]' => TRUE), t('Install'));
|
||||
$this->drupalPostForm('admin/modules', array('config_install_dependency_test[enable]' => TRUE), t('Install'));
|
||||
$this->assertRaw('Unable to install <em class="placeholder">Config install dependency test</em> due to unmet dependencies: <em class="placeholder">config_test.dynamic.other_module_test_with_dependency (config_other_module_config_test)</em>');
|
||||
|
||||
$this->drupalPostForm('admin/modules', array('modules[Testing][config_other_module_config_test][enable]' => TRUE), t('Install'));
|
||||
$this->drupalPostForm('admin/modules', array('modules[Testing][config_install_dependency_test][enable]' => TRUE), t('Install'));
|
||||
$this->drupalPostForm('admin/modules', array('config_other_module_config_test[enable]' => TRUE), t('Install'));
|
||||
$this->drupalPostForm('admin/modules', array('config_install_dependency_test[enable]' => TRUE), t('Install'));
|
||||
$this->rebuildContainer();
|
||||
$this->assertTrue(entity_load('config_test', 'other_module_test_with_dependency'), 'The config_test.dynamic.other_module_test_with_dependency configuration has been created during install.');
|
||||
}
|
||||
|
@ -197,7 +197,7 @@ class ConfigInstallWebTest extends WebTestBase {
|
|||
*/
|
||||
public function testConfigModuleRequirements() {
|
||||
$this->drupalLogin($this->adminUser);
|
||||
$this->drupalPostForm('admin/modules', array('modules[Core][config][enable]' => TRUE), t('Install'));
|
||||
$this->drupalPostForm('admin/modules', array('config[enable]' => TRUE), t('Install'));
|
||||
|
||||
$directory = config_get_config_directory(CONFIG_SYNC_DIRECTORY);
|
||||
file_unmanaged_delete_recursive($directory);
|
||||
|
|
|
@ -63,7 +63,7 @@ ENDPO;
|
|||
$this->drupalPostForm('admin/config/regional/language/add', ['predefined_langcode' => 'fr'], t('Add custom language'));
|
||||
|
||||
$edit = [
|
||||
'modules[Multilingual][config_translation][enable]' => TRUE,
|
||||
'config_translation[enable]' => TRUE,
|
||||
];
|
||||
$this->drupalPostForm('admin/modules', $edit, t('Install'));
|
||||
|
||||
|
|
|
@ -24,8 +24,8 @@ class ContentTranslationEnableTest extends WebTestBase {
|
|||
// Enable modules and make sure the related config entity type definitions
|
||||
// are installed.
|
||||
$edit = [
|
||||
'modules[Multilingual][content_translation][enable]' => TRUE,
|
||||
'modules[Multilingual][language][enable]' => TRUE,
|
||||
'content_translation[enable]' => TRUE,
|
||||
'language[enable]' => TRUE,
|
||||
];
|
||||
$this->drupalPostForm('admin/modules', $edit, t('Install'));
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ class ForumUninstallTest extends WebTestBase {
|
|||
$this->assertFalse((bool) NodeType::load('forum'), 'Node type with machine forum deleted.');
|
||||
|
||||
// Double check everything by reinstalling the forum module again.
|
||||
$this->drupalPostForm('admin/modules', ['modules[Core][forum][enable]' => 1], 'Install');
|
||||
$this->drupalPostForm('admin/modules', ['forum[enable]' => 1], 'Install');
|
||||
$this->assertText('Module Forum has been enabled.');
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ class LanguageListModuleInstallTest extends WebTestBase {
|
|||
$admin_user = $this->drupalCreateUser(array('access administration pages', 'administer modules'));
|
||||
$this->drupalLogin($admin_user);
|
||||
$edit = array();
|
||||
$edit['modules[Multilingual][language][enable]'] = 'language';
|
||||
$edit['language[enable]'] = 'language';
|
||||
$this->drupalPostForm('admin/modules', $edit, t('Install'));
|
||||
|
||||
$this->assertEqual(\Drupal::state()->get('language_test.language_count_preinstall', 0), 1, 'Using LanguageManager::getLanguages() returns 1 language during Language installation.');
|
||||
|
|
|
@ -184,7 +184,7 @@ class LanguageNegotiationInfoTest extends WebTestBase {
|
|||
$this->assertTrue($this->isLanguageTypeConfigurable($test_type), 'Language type is now configurable.');
|
||||
|
||||
// After installing another module, the config should be the same.
|
||||
$this->drupalPostForm('admin/modules', ['modules[Testing][test_module][enable]' => 1], t('Install'));
|
||||
$this->drupalPostForm('admin/modules', ['test_module[enable]' => 1], t('Install'));
|
||||
$this->assertTrue($this->isLanguageTypeConfigurable($test_type), 'Language type is still configurable.');
|
||||
|
||||
// After uninstalling the other module, the config should be the same.
|
||||
|
|
|
@ -109,7 +109,7 @@ class LocaleConfigTranslationImportTest extends WebTestBase {
|
|||
->save();
|
||||
|
||||
// Install any module.
|
||||
$this->drupalPostForm('admin/modules', ['modules[Core][dblog][enable]' => 'dblog'], t('Install'));
|
||||
$this->drupalPostForm('admin/modules', ['dblog[enable]' => 'dblog'], t('Install'));
|
||||
$this->assertText('Module Database Logging has been enabled.');
|
||||
|
||||
// Get the front page and ensure that the translated configuration still
|
||||
|
|
|
@ -119,7 +119,7 @@ class LocaleConfigTranslationTest extends WebTestBase {
|
|||
$this->assertFalse($string, 'Configuration strings have been created upon installation.');
|
||||
|
||||
// Enable the image module.
|
||||
$this->drupalPostForm('admin/modules', array('modules[Field types][image][enable]' => "1"), t('Install'));
|
||||
$this->drupalPostForm('admin/modules', array('image[enable]' => "1"), t('Install'));
|
||||
$this->rebuildContainer();
|
||||
|
||||
$string = $this->storage->findString(array('source' => 'Medium (220×220)', 'context' => '', 'type' => 'configuration'));
|
||||
|
@ -198,12 +198,12 @@ class LocaleConfigTranslationTest extends WebTestBase {
|
|||
public function testOptionalConfiguration() {
|
||||
$this->assertNodeConfig(FALSE, FALSE);
|
||||
// Enable the node module.
|
||||
$this->drupalPostForm('admin/modules', ['modules[Core][node][enable]' => "1"], t('Install'));
|
||||
$this->drupalPostForm('admin/modules', ['node[enable]' => "1"], t('Install'));
|
||||
$this->drupalPostForm(NULL, [], t('Continue'));
|
||||
$this->rebuildContainer();
|
||||
$this->assertNodeConfig(TRUE, FALSE);
|
||||
// Enable the views module (which node provides some optional config for).
|
||||
$this->drupalPostForm('admin/modules', ['modules[Core][views][enable]' => "1"], t('Install'));
|
||||
$this->drupalPostForm('admin/modules', ['views[enable]' => "1"], t('Install'));
|
||||
$this->rebuildContainer();
|
||||
$this->assertNodeConfig(TRUE, TRUE);
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ class LocaleLocaleLookupTest extends WebTestBase {
|
|||
*/
|
||||
public function testCircularDependency() {
|
||||
// Ensure that we can enable early_translation_test on a non-english site.
|
||||
$this->drupalPostForm('admin/modules', array('modules[Testing][early_translation_test][enable]' => TRUE), t('Install'));
|
||||
$this->drupalPostForm('admin/modules', array('early_translation_test[enable]' => TRUE), t('Install'));
|
||||
$this->assertResponse(200);
|
||||
}
|
||||
|
||||
|
|
|
@ -308,7 +308,7 @@ class LocaleUpdateTest extends LocaleUpdateBase {
|
|||
|
||||
// Enable a module.
|
||||
$edit = array(
|
||||
'modules[Testing][locale_test_translate][enable]' => 'locale_test_translate',
|
||||
'locale_test_translate[enable]' => 'locale_test_translate',
|
||||
);
|
||||
$this->drupalPostForm('admin/modules', $edit, t('Install'));
|
||||
|
||||
|
@ -343,7 +343,7 @@ class LocaleUpdateTest extends LocaleUpdateBase {
|
|||
|
||||
// Enable a module.
|
||||
$edit = array(
|
||||
'modules[Testing][locale_test_translate][enable]' => 'locale_test_translate',
|
||||
'locale_test_translate[enable]' => 'locale_test_translate',
|
||||
);
|
||||
$this->drupalPostForm('admin/modules', $edit, t('Install'));
|
||||
|
||||
|
@ -387,7 +387,7 @@ class LocaleUpdateTest extends LocaleUpdateBase {
|
|||
|
||||
// Enable a module.
|
||||
$edit = array(
|
||||
'modules[Testing][locale_test_translate][enable]' => 'locale_test_translate',
|
||||
'locale_test_translate[enable]' => 'locale_test_translate',
|
||||
);
|
||||
$this->drupalPostForm('admin/modules', $edit, t('Install'));
|
||||
|
||||
|
|
|
@ -145,11 +145,11 @@ class ModulesListForm extends FormBase {
|
|||
uasort($modules, 'system_sort_modules_by_info_name');
|
||||
|
||||
// Iterate over each of the modules.
|
||||
$form['modules']['#tree'] = TRUE;
|
||||
foreach ($modules as $filename => $module) {
|
||||
if (empty($module->info['hidden'])) {
|
||||
$package = $module->info['package'];
|
||||
$form['modules'][$package][$filename] = $this->buildRow($modules, $module, $distribution);
|
||||
$form['modules'][$package][$filename]['#tree'] = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -357,8 +357,6 @@ class ModulesListForm extends FormBase {
|
|||
* An array of modules to install and their dependencies.
|
||||
*/
|
||||
protected function buildModuleList(FormStateInterface $form_state) {
|
||||
$packages = $form_state->getValue('modules');
|
||||
|
||||
// Build a list of modules to install.
|
||||
$modules = array(
|
||||
'install' => array(),
|
||||
|
@ -366,24 +364,22 @@ class ModulesListForm extends FormBase {
|
|||
'experimental' => [],
|
||||
);
|
||||
|
||||
// Required modules have to be installed.
|
||||
// @todo This should really not be handled here.
|
||||
$data = system_rebuild_module_data();
|
||||
foreach ($data as $name => $module) {
|
||||
if (!empty($module->required) && !$this->moduleHandler->moduleExists($name)) {
|
||||
// If the module is installed there is nothing to do.
|
||||
if ($this->moduleHandler->moduleExists($name)) {
|
||||
continue;
|
||||
}
|
||||
// Required modules have to be installed.
|
||||
if (!empty($module->required)) {
|
||||
$modules['install'][$name] = $module->info['name'];
|
||||
}
|
||||
}
|
||||
|
||||
// First, build a list of all modules that were selected.
|
||||
foreach ($packages as $package => $items) {
|
||||
foreach ($items as $name => $checkbox) {
|
||||
if ($checkbox['enable'] && !$this->moduleHandler->moduleExists($name)) {
|
||||
$modules['install'][$name] = $data[$name]->info['name'];
|
||||
// Identify experimental modules.
|
||||
if ($package == 'Core (Experimental)') {
|
||||
$modules['experimental'][$name] = $data[$name]->info['name'];
|
||||
}
|
||||
// Selected modules should be installed.
|
||||
elseif (($checkbox = $form_state->getValue($name, FALSE)) && $checkbox['enable']) {
|
||||
$modules['install'][$name] = $data[$name]->info['name'];
|
||||
// Identify experimental modules.
|
||||
if ($data[$name]->info['package'] == 'Core (Experimental)') {
|
||||
$modules['experimental'][$name] = $data[$name]->info['name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -117,8 +117,8 @@ ENDPO;
|
|||
// Activate a module, to make sure that config is not overridden by module
|
||||
// installation.
|
||||
$edit = array(
|
||||
'modules[Core][views][enable]' => TRUE,
|
||||
'modules[Core][filter][enable]' => TRUE,
|
||||
'views[enable]' => TRUE,
|
||||
'filter[enable]' => TRUE,
|
||||
);
|
||||
$this->drupalPostForm('admin/modules', $edit, t('Install'));
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ class InstallerTranslationTest extends InstallerTestBase {
|
|||
$this->assertEqual($account->language()->getId(), 'de', 'New user is German.');
|
||||
|
||||
// Ensure that we can enable basic_auth on a non-english site.
|
||||
$this->drupalPostForm('admin/modules', array('modules[Web services][basic_auth][enable]' => TRUE), t('Install'));
|
||||
$this->drupalPostForm('admin/modules', array('basic_auth[enable]' => TRUE), t('Install'));
|
||||
$this->assertResponse(200);
|
||||
|
||||
// Assert that the theme CSS was added to the page.
|
||||
|
|
|
@ -76,8 +76,8 @@ class ClassLoaderTest extends WebTestBase {
|
|||
public function testMultipleModules() {
|
||||
$this->drupalLogin($this->rootUser);
|
||||
$edit = [
|
||||
"modules[Testing][module_install_class_loader_test1][enable]" => TRUE,
|
||||
"modules[Testing][module_install_class_loader_test2][enable]" => TRUE,
|
||||
"module_install_class_loader_test1[enable]" => TRUE,
|
||||
"module_install_class_loader_test2[enable]" => TRUE,
|
||||
];
|
||||
$this->drupalPostForm('admin/modules', $edit, t('Install'));
|
||||
$this->rebuildContainer();
|
||||
|
|
|
@ -14,12 +14,12 @@ class DependencyTest extends ModuleTestBase {
|
|||
*/
|
||||
function testProjectNamespaceForDependencies() {
|
||||
$edit = array(
|
||||
'modules[Core][filter][enable]' => TRUE,
|
||||
'filter[enable]' => TRUE,
|
||||
);
|
||||
$this->drupalPostForm('admin/modules', $edit, t('Install'));
|
||||
// Enable module with project namespace to ensure nothing breaks.
|
||||
$edit = array(
|
||||
'modules[Testing][system_project_namespace_test][enable]' => TRUE,
|
||||
'system_project_namespace_test[enable]' => TRUE,
|
||||
);
|
||||
$this->drupalPostForm('admin/modules', $edit, t('Install'));
|
||||
$this->assertModules(array('system_project_namespace_test'), TRUE);
|
||||
|
@ -31,7 +31,7 @@ class DependencyTest extends ModuleTestBase {
|
|||
function testEnableWithoutDependency() {
|
||||
// Attempt to enable Content Translation without Language enabled.
|
||||
$edit = array();
|
||||
$edit['modules[Multilingual][content_translation][enable]'] = 'content_translation';
|
||||
$edit['content_translation[enable]'] = 'content_translation';
|
||||
$this->drupalPostForm('admin/modules', $edit, t('Install'));
|
||||
$this->assertText(t('Some required modules must be enabled'), 'Dependency required.');
|
||||
|
||||
|
@ -57,7 +57,7 @@ class DependencyTest extends ModuleTestBase {
|
|||
// as missing a dependency.
|
||||
$this->drupalGet('admin/modules');
|
||||
$this->assertRaw(t('@module (<span class="admin-missing">missing</span>)', array('@module' => Unicode::ucfirst('_missing_dependency'))), 'A module with missing dependencies is marked as such.');
|
||||
$checkbox = $this->xpath('//input[@type="checkbox" and @disabled="disabled" and @name="modules[Testing][system_dependencies_test][enable]"]');
|
||||
$checkbox = $this->xpath('//input[@type="checkbox" and @disabled="disabled" and @name="system_dependencies_test[enable]"]');
|
||||
$this->assert(count($checkbox) == 1, 'Checkbox for the module is disabled.');
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ class DependencyTest extends ModuleTestBase {
|
|||
'@module' => 'System incompatible module version test (>2.0)',
|
||||
'@version' => '1.0',
|
||||
)), 'A module that depends on an incompatible version of a module is marked as such.');
|
||||
$checkbox = $this->xpath('//input[@type="checkbox" and @disabled="disabled" and @name="modules[Testing][system_incompatible_module_version_dependencies_test][enable]"]');
|
||||
$checkbox = $this->xpath('//input[@type="checkbox" and @disabled="disabled" and @name="system_incompatible_module_version_dependencies_test[enable]"]');
|
||||
$this->assert(count($checkbox) == 1, 'Checkbox for the module is disabled.');
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,7 @@ class DependencyTest extends ModuleTestBase {
|
|||
$this->assertRaw(t('@module (<span class="admin-missing">incompatible with</span> this version of Drupal core)', array(
|
||||
'@module' => 'System incompatible core version test',
|
||||
)), 'A module that depends on a module with an incompatible core version is marked as such.');
|
||||
$checkbox = $this->xpath('//input[@type="checkbox" and @disabled="disabled" and @name="modules[Testing][system_incompatible_core_version_dependencies_test][enable]"]');
|
||||
$checkbox = $this->xpath('//input[@type="checkbox" and @disabled="disabled" and @name="system_incompatible_core_version_dependencies_test[enable]"]');
|
||||
$this->assert(count($checkbox) == 1, 'Checkbox for the module is disabled.');
|
||||
}
|
||||
|
||||
|
@ -101,8 +101,8 @@ class DependencyTest extends ModuleTestBase {
|
|||
|
||||
// Attempt to install both modules at the same time.
|
||||
$edit = array();
|
||||
$edit['modules[Testing][requirements1_test][enable]'] = 'requirements1_test';
|
||||
$edit['modules[Testing][requirements2_test][enable]'] = 'requirements2_test';
|
||||
$edit['requirements1_test[enable]'] = 'requirements1_test';
|
||||
$edit['requirements2_test[enable]'] = 'requirements2_test';
|
||||
$this->drupalPostForm('admin/modules', $edit, t('Install'));
|
||||
|
||||
// Makes sure the modules were NOT installed.
|
||||
|
@ -133,15 +133,15 @@ class DependencyTest extends ModuleTestBase {
|
|||
// Enable the modules through the UI, verifying that the dependency chain
|
||||
// is correct.
|
||||
$edit = array();
|
||||
$edit['modules[Core][color][enable]'] = 'color';
|
||||
$edit['color[enable]'] = 'color';
|
||||
$this->drupalPostForm('admin/modules', $edit, t('Install'));
|
||||
$this->assertModules(array('color'), FALSE);
|
||||
// Note that dependencies are sorted alphabetically in the confirmation
|
||||
// message.
|
||||
$this->assertText(t('You must enable the Configuration Manager, Help modules to install Color.'));
|
||||
|
||||
$edit['modules[Core][config][enable]'] = 'config';
|
||||
$edit['modules[Core][help][enable]'] = 'help';
|
||||
$edit['config[enable]'] = 'config';
|
||||
$edit['help[enable]'] = 'help';
|
||||
$this->drupalPostForm('admin/modules', $edit, t('Install'));
|
||||
$this->assertModules(array('color', 'config', 'help'), TRUE);
|
||||
|
||||
|
@ -155,7 +155,7 @@ class DependencyTest extends ModuleTestBase {
|
|||
*/
|
||||
function testUninstallDependents() {
|
||||
// Enable the forum module.
|
||||
$edit = array('modules[Core][forum][enable]' => 'forum');
|
||||
$edit = array('forum[enable]' => 'forum');
|
||||
$this->drupalPostForm('admin/modules', $edit, t('Install'));
|
||||
$this->drupalPostForm(NULL, array(), t('Continue'));
|
||||
$this->assertModules(array('forum'), TRUE);
|
||||
|
|
|
@ -36,7 +36,7 @@ class ExperimentalModuleTest extends WebTestBase {
|
|||
// First, test installing a non-experimental module with no dependencies.
|
||||
// There should be no confirmation form and no experimental module warning.
|
||||
$edit = [];
|
||||
$edit["modules[Testing][test_page_test][enable]"] = TRUE;
|
||||
$edit["test_page_test[enable]"] = TRUE;
|
||||
$this->drupalPostForm('admin/modules', $edit, t('Install'));
|
||||
$this->assertText('Module Test page has been enabled.');
|
||||
$this->assertNoText('Experimental modules are provided for testing purposes only.');
|
||||
|
@ -48,7 +48,7 @@ class ExperimentalModuleTest extends WebTestBase {
|
|||
// There should be a confirmation form with an experimental warning, but no
|
||||
// list of dependencies.
|
||||
$edit = [];
|
||||
$edit["modules[Core (Experimental)][experimental_module_test][enable]"] = TRUE;
|
||||
$edit["experimental_module_test[enable]"] = TRUE;
|
||||
$this->drupalPostForm('admin/modules', $edit, 'Install');
|
||||
|
||||
// The module should not be enabled and there should be a warning and a
|
||||
|
@ -70,7 +70,7 @@ class ExperimentalModuleTest extends WebTestBase {
|
|||
// Test enabling a module that is not itself experimental, but that depends
|
||||
// on an experimental module.
|
||||
$edit = [];
|
||||
$edit["modules[Testing][experimental_module_dependency_test][enable]"] = TRUE;
|
||||
$edit["experimental_module_dependency_test[enable]"] = TRUE;
|
||||
$this->drupalPostForm('admin/modules', $edit, 'Install');
|
||||
|
||||
// The module should not be enabled and there should be a warning and a
|
||||
|
@ -98,8 +98,8 @@ class ExperimentalModuleTest extends WebTestBase {
|
|||
// still a warning about experimental modules, but no message about
|
||||
// dependencies, since the user specifically enabled the dependency.
|
||||
$edit = [];
|
||||
$edit["modules[Core (Experimental)][experimental_module_test][enable]"] = TRUE;
|
||||
$edit["modules[Testing][experimental_module_dependency_test][enable]"] = TRUE;
|
||||
$edit["experimental_module_test[enable]"] = TRUE;
|
||||
$edit["experimental_module_dependency_test[enable]"] = TRUE;
|
||||
$this->drupalPostForm('admin/modules', $edit, 'Install');
|
||||
|
||||
// The module should not be enabled and there should be a warning and a
|
||||
|
@ -110,7 +110,7 @@ class ExperimentalModuleTest extends WebTestBase {
|
|||
$this->assertText('The following modules are experimental: Experimental Test');
|
||||
|
||||
// Ensure the non-experimental module is not listed as experimental.
|
||||
$this->assertNoText('The following modules are experimental: Experimental Test, Experimental Dependency Test');
|
||||
$this->assertNoText('The following modules are experimental: Experimental Dependency Test, Experimental Test');
|
||||
$this->assertNoText('The following modules are experimental: Experimental Dependency Test');
|
||||
|
||||
// There should be no message about enabling dependencies.
|
||||
|
@ -118,13 +118,13 @@ class ExperimentalModuleTest extends WebTestBase {
|
|||
|
||||
// Enable the module and confirm that it worked.
|
||||
$this->drupalPostForm(NULL, [], 'Continue');
|
||||
$this->assertText('2 modules have been enabled: Experimental Test, Experimental Dependency Test');
|
||||
$this->assertText('2 modules have been enabled: Experimental Dependency Test, Experimental Test');
|
||||
|
||||
// Try to enable an experimental module that can not be due to
|
||||
// hook_requirements().
|
||||
\Drupal::state()->set('experimental_module_requirements_test_requirements', TRUE);
|
||||
$edit = [];
|
||||
$edit["modules[Core (Experimental)][experimental_module_requirements_test][enable]"] = TRUE;
|
||||
$edit["experimental_module_requirements_test[enable]"] = TRUE;
|
||||
$this->drupalPostForm('admin/modules', $edit, 'Install');
|
||||
$this->assertUrl('admin/modules', [], 'If the module can not be installed we are not taken to the confirm form.');
|
||||
$this->assertText('The Experimental Test Requirements module can not be installed.');
|
||||
|
|
|
@ -16,7 +16,7 @@ class HookRequirementsTest extends ModuleTestBase {
|
|||
|
||||
// Attempt to install the requirements1_test module.
|
||||
$edit = array();
|
||||
$edit['modules[Testing][requirements1_test][enable]'] = 'requirements1_test';
|
||||
$edit['requirements1_test[enable]'] = 'requirements1_test';
|
||||
$this->drupalPostForm('admin/modules', $edit, t('Install'));
|
||||
|
||||
// Makes sure the module was NOT installed.
|
||||
|
|
|
@ -59,8 +59,7 @@ class InstallUninstallTest extends ModuleTestBase {
|
|||
unset($all_modules['help']);
|
||||
$this->assertModuleNotInstalled('help');
|
||||
$edit = array();
|
||||
$package = $required_modules['help']->info['package'];
|
||||
$edit["modules[$package][help][enable]"] = TRUE;
|
||||
$edit["help[enable]"] = TRUE;
|
||||
$this->drupalPostForm('admin/modules', $edit, t('Install'));
|
||||
$this->assertText('has been enabled', 'Modules status has been updated.');
|
||||
$this->assertText(t('hook_modules_installed fired for help'));
|
||||
|
@ -93,7 +92,7 @@ class InstallUninstallTest extends ModuleTestBase {
|
|||
// Install the module.
|
||||
$edit = array();
|
||||
$package = $module->info['package'];
|
||||
$edit["modules[$package][$name][enable]"] = TRUE;
|
||||
$edit[$name . '[enable]'] = TRUE;
|
||||
$this->drupalPostForm('admin/modules', $edit, t('Install'));
|
||||
|
||||
// Handle experimental modules, which require a confirmation screen.
|
||||
|
@ -191,7 +190,7 @@ class InstallUninstallTest extends ModuleTestBase {
|
|||
$edit = array();
|
||||
$experimental = FALSE;
|
||||
foreach ($all_modules as $name => $module) {
|
||||
$edit['modules[' . $module->info['package'] . '][' . $name . '][enable]'] = TRUE;
|
||||
$edit[$name . '[enable]'] = TRUE;
|
||||
// Track whether there is at least one experimental module.
|
||||
if ($module->info['package'] == 'Core (Experimental)') {
|
||||
$experimental = TRUE;
|
||||
|
|
|
@ -18,7 +18,7 @@ class RequiredTest extends ModuleTestBase {
|
|||
// 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]";
|
||||
$field_name = $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)));
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ class VersionTest extends ModuleTestBase {
|
|||
$n = count($dependencies);
|
||||
for ($i = 0; $i < $n; $i++) {
|
||||
$this->drupalGet('admin/modules');
|
||||
$checkbox = $this->xpath('//input[@id="edit-modules-testing-module-test-enable"]');
|
||||
$checkbox = $this->xpath('//input[@id="edit-module-test-enable"]');
|
||||
$this->assertEqual(!empty($checkbox[0]['disabled']), $i % 2, $dependencies[$i]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ class MainContentFallbackTest extends WebTestBase {
|
|||
// Enable the block module again.
|
||||
$this->drupalLogin($this->adminUser);
|
||||
$edit = array();
|
||||
$edit['modules[Core][block][enable]'] = 'block';
|
||||
$edit['block[enable]'] = 'block';
|
||||
$this->drupalPostForm('admin/modules', $edit, t('Install'));
|
||||
$this->assertText(t('Module Block has been enabled.'), 'Modules status has been updated.');
|
||||
$this->rebuildContainer();
|
||||
|
|
|
@ -112,7 +112,7 @@ class ToolbarAdminMenuTest extends WebTestBase {
|
|||
|
||||
// Enable a module.
|
||||
$edit = array();
|
||||
$edit['modules[Core][taxonomy][enable]'] = TRUE;
|
||||
$edit['taxonomy[enable]'] = TRUE;
|
||||
$this->drupalPostForm('admin/modules', $edit, t('Install'));
|
||||
$this->rebuildContainer();
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ class UpdateUploadTest extends UpdateTestBase {
|
|||
$this->assertEqual($info['version'], '8.x-1.0');
|
||||
|
||||
// Enable the module.
|
||||
$this->drupalPostForm('admin/modules', array('modules[Testing][update_test_new_module][enable]' => TRUE), t('Install'));
|
||||
$this->drupalPostForm('admin/modules', array('update_test_new_module[enable]' => TRUE), t('Install'));
|
||||
|
||||
// Define the update XML such that the new module downloaded above needs an
|
||||
// update from 8.x-1.0 to 8.x-1.1.
|
||||
|
|
Loading…
Reference in New Issue