function DependencyTest::testEnableRequirementsFailureDependency
Same name in other branches
- 9 core/modules/system/tests/src/Functional/Module/DependencyTest.php \Drupal\Tests\system\Functional\Module\DependencyTest::testEnableRequirementsFailureDependency()
- 8.9.x core/modules/system/tests/src/Functional/Module/DependencyTest.php \Drupal\Tests\system\Functional\Module\DependencyTest::testEnableRequirementsFailureDependency()
- 11.x core/modules/system/tests/src/Functional/Module/DependencyTest.php \Drupal\Tests\system\Functional\Module\DependencyTest::testEnableRequirementsFailureDependency()
Tests enabling a module that depends on a module which fails hook_requirements().
File
-
core/
modules/ system/ tests/ src/ Functional/ Module/ DependencyTest.php, line 215
Class
- DependencyTest
- Enable module without dependency enabled.
Namespace
Drupal\Tests\system\Functional\ModuleCode
public function testEnableRequirementsFailureDependency() : void {
\Drupal::service('module_installer')->install([
'comment',
]);
$this->assertModules([
'requirements1_test',
], FALSE);
$this->assertModules([
'requirements2_test',
], FALSE);
// Attempt to install both modules at the same time.
$edit = [];
$edit['modules[requirements1_test][enable]'] = 'requirements1_test';
$edit['modules[requirements2_test][enable]'] = 'requirements2_test';
$this->drupalGet('admin/modules');
$this->submitForm($edit, 'Install');
// Makes sure the modules were NOT installed.
$this->assertSession()
->pageTextContains('Requirements 1 Test failed requirements');
$this->assertModules([
'requirements1_test',
], FALSE);
$this->assertModules([
'requirements2_test',
], FALSE);
// Makes sure that already enabled modules the failing modules depend on
// were not disabled.
$this->assertModules([
'comment',
], TRUE);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.