function ModuleHandlerTest::testProfileAllDependencies
Same name and namespace in other branches
- 11.x core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php \Drupal\Tests\system\Kernel\Extension\ModuleHandlerTest::testProfileAllDependencies()
- 10 core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php \Drupal\Tests\system\Kernel\Extension\ModuleHandlerTest::testProfileAllDependencies()
- 9 core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php \Drupal\Tests\system\Kernel\Extension\ModuleHandlerTest::testProfileAllDependencies()
- 8.9.x core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php \Drupal\Tests\system\Kernel\Extension\ModuleHandlerTest::testProfileAllDependencies()
Tests that a profile can supply only real dependencies.
File
-
core/
modules/ system/ tests/ src/ Kernel/ Extension/ ModuleHandlerTest.php, line 224
Class
- ModuleHandlerTest
- Tests ModuleHandler functionality.
Namespace
Drupal\Tests\system\Kernel\ExtensionCode
public function testProfileAllDependencies() : void {
$profile = 'testing_install_profile_all_dependencies';
$dependencies = [
'dblog',
'dependency_foo_test',
];
$this->setInstallProfile($profile);
$this->enableModules([
'module_test',
$profile,
]);
$data = \Drupal::service('extension.list.module')->reset()
->getList();
foreach ($dependencies as $dependency) {
$this->assertArrayHasKey($dependency, $data[$profile]->requires);
}
$this->moduleInstaller()
->install($dependencies);
foreach ($dependencies as $dependency) {
$this->assertTrue($this->moduleHandler()
->moduleExists($dependency));
}
// Try uninstalling the dependencies.
$this->expectException(ModuleUninstallValidatorException::class);
$this->expectExceptionMessageIs("The following reasons prevent the modules from being uninstalled: The 'Testing install profile all dependencies' install profile requires 'Database Logging'; The 'Testing install profile all dependencies' install profile requires 'Dependency foo test module'");
$this->moduleInstaller()
->uninstall($dependencies);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.