function ModulesListFormWebTest::testInstalledIncompatibleModule
Same name in other branches
- 9 core/modules/system/tests/src/Functional/Form/ModulesListFormWebTest.php \Drupal\Tests\system\Functional\Form\ModulesListFormWebTest::testInstalledIncompatibleModule()
- 10 core/modules/system/tests/src/Functional/Form/ModulesListFormWebTest.php \Drupal\Tests\system\Functional\Form\ModulesListFormWebTest::testInstalledIncompatibleModule()
Tests that incompatible modules message is shown.
File
-
core/
modules/ system/ tests/ src/ Functional/ Form/ ModulesListFormWebTest.php, line 171
Class
Namespace
Drupal\Tests\system\Functional\FormCode
public function testInstalledIncompatibleModule() : void {
$incompatible_modules_message = 'There are errors with some installed modules. Visit the status report page for more information.';
$path = \Drupal::getContainer()->getParameter('site.path') . "/modules/changing_module";
mkdir($path, 0777, TRUE);
$file_path = "{$path}/changing_module.info.yml";
$info = [
'name' => 'Module that changes',
'type' => 'module',
];
$compatible_info = $info + [
'core_version_requirement' => '*',
];
$incompatible_info = $info + [
'core_version_requirement' => '^1',
];
$this->writeInfoFile($file_path, $compatible_info);
$edit = [
'modules[changing_module][enable]' => 'changing_module',
];
$this->drupalGet('admin/modules');
$this->submitForm($edit, 'Install');
$this->assertSession()
->pageTextContains('Module Module that changes has been installed.');
$this->writeInfoFile($file_path, $incompatible_info);
$this->drupalGet('admin/modules');
$this->assertSession()
->pageTextContains($incompatible_modules_message);
$this->writeInfoFile($file_path, $compatible_info);
$this->drupalGet('admin/modules');
$this->assertSession()
->pageTextNotContains($incompatible_modules_message);
// Uninstall the module and ensure that incompatible modules message is not
// displayed for modules that are not installed.
$edit = [
'uninstall[changing_module]' => 'changing_module',
];
$this->drupalGet('admin/modules/uninstall');
$this->submitForm($edit, 'Uninstall');
$this->submitForm([], 'Uninstall');
$this->assertSession()
->pageTextContains('The selected modules have been uninstalled.');
$this->writeInfoFile($file_path, $incompatible_info);
$this->drupalGet('admin/modules');
$this->assertSession()
->pageTextNotContains($incompatible_modules_message);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.