Skip to content
Snippets Groups Projects
Commit f897aa8c authored by catch's avatar catch
Browse files

Issue #3250376 by nicxvan, dcam, longwave, jonathan1055, smustgrave,...

Issue #3250376 by nicxvan, dcam, longwave, jonathan1055, smustgrave, prashant.c, quietone, ckrina: Uninstall page shows module machine names as requirements
parent 8cd685b9
Branches
No related tags found
4 merge requests!12628#3524738 backport without deprecation,!12477#3532243: JSON support status during updates,!5423Draft: Resolve #3329907 "Test2",!213Issue #2906496: Give Media a menu item under Content
Pipeline #536247 passed
Pipeline: drupal

#536248

    ......@@ -106,7 +106,8 @@ public function buildForm(array $form, FormStateInterface $form_state) {
    include_once DRUPAL_ROOT . '/core/includes/install.inc';
    // Get a list of all available modules that can be uninstalled.
    $uninstallable = array_filter($this->moduleExtensionList->getList(), function ($module) {
    $modules = $this->moduleExtensionList->getList();
    $uninstallable = array_filter($modules, function ($module) {
    return empty($module->info['required']) && $module->status;
    });
    ......@@ -199,7 +200,13 @@ public function buildForm(array $form, FormStateInterface $form_state) {
    // we can allow this module to be uninstalled.
    foreach (array_keys($module->required_by) as $dependent) {
    if ($this->updateRegistry->getInstalledVersion($dependent) !== $this->updateRegistry::SCHEMA_UNINSTALLED) {
    $form['modules'][$module->getName()]['#required_by'][] = $dependent;
    $module_name = $modules[$dependent]->info['name'];
    if ($dependent != strtolower(str_replace(' ', '_', $module_name))) {
    $form['modules'][$module->getName()]['#required_by'][] = $module_name . " (" . $dependent . ")";
    }
    else {
    $form['modules'][$module->getName()]['#required_by'][] = $module_name;
    }
    $form['uninstall'][$module->getName()]['#disabled'] = TRUE;
    }
    }
    ......
    ......@@ -22,7 +22,15 @@ class UninstallTest extends BrowserTestBase {
    /**
    * {@inheritdoc}
    */
    protected static $modules = ['module_test', 'user', 'views', 'node'];
    protected static $modules = [
    'ckeditor5',
    'filter',
    'module_test',
    'node',
    'user',
    'views',
    'views_ui',
    ];
    /**
    * {@inheritdoc}
    ......@@ -118,6 +126,13 @@ public function testUninstallPage(): void {
    // Delete the node to allow node to be uninstalled.
    $node->delete();
    // Ensure dependent module full names are shown.
    $this->assertSession()->pageTextContains('Required by: Views UI');
    // Ensure matching machine names do not display.
    $this->assertSession()->pageTextNotContains('Required by: Views UI (views_ui)');
    // Ensure machine names that do not match do display.
    $this->assertSession()->pageTextContains('Text Editor (editor)');
    // Uninstall module_test.
    $edit = [];
    $edit['uninstall[module_test]'] = TRUE;
    ......
    ......@@ -90,8 +90,8 @@ public function testInstalled(): void {
    // uninstalled being dependencies of the "driver_test" module.
    $this->drupalGet('admin/modules/uninstall');
    $this->assertSession()->elementTextContains('xpath', '//tr[@data-drupal-selector="edit-driver-test"]', "The following reason prevents Contrib database driver test from being uninstalled: The module 'Contrib database driver test' is providing the database driver '{$this->testDriverName}'.");
    $this->assertSession()->elementTextContains('xpath', '//tr[@data-drupal-selector="edit-mysql"]', "The following reason prevents MySQL from being uninstalled: Required by: driver_test");
    $this->assertSession()->elementTextContains('xpath', '//tr[@data-drupal-selector="edit-pgsql"]', "The following reason prevents PostgreSQL from being uninstalled: Required by: driver_test");
    $this->assertSession()->elementTextContains('xpath', '//tr[@data-drupal-selector="edit-mysql"]', "The following reason prevents MySQL from being uninstalled: Required by: Contrib database driver test (driver_test)");
    $this->assertSession()->elementTextContains('xpath', '//tr[@data-drupal-selector="edit-pgsql"]', "The following reason prevents PostgreSQL from being uninstalled: Required by: Contrib database driver test (driver_test)");
    }
    /**
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment