public function DependencyTest::testEnableRequirementsFailureDependency in Drupal 8
Same name and namespace in other branches
- 9 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 136
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
->drupalPostForm('admin/modules', $edit, t('Install'));
// Makes sure the modules were NOT installed.
$this
->assertText(t('Requirements 1 Test failed requirements'), 'Modules status has been updated.');
$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);
}