public function DependencyTest::testEnableRequirementsFailureDependency in Drupal 9
Same name and namespace in other branches
- 8 core/modules/system/tests/src/Functional/Module/DependencyTest.php \Drupal\Tests\system\Functional\Module\DependencyTest::testEnableRequirementsFailureDependency()
- 10 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 134
Class
- DependencyTest
- Enable module without dependency enabled.
Namespace
Drupal\Tests\system\Functional\ModuleCode
public function testEnableRequirementsFailureDependency() {
\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);
}