Problem/Motivation
lib/Drupal/Core/Extension/ThemeInstaller.php
15:use Drupal\system\ModuleDependencyMessageTrait;
23: use ModuleDependencyMessageTrait;
This introduces a dependency on a module in a core component, which shouldn't happen.
Steps to reproduce
Look at the code ;)
I'm also getting failures due to this in kernel tests that don't install system module, but not in all cases -- not sure of what the exact conditions are to fail.
Proposed resolution
Remove the use of ModuleDependencyMessageTrait here. The way it's used is really weird:
if ($incompatible = $this->checkDependencyMessage($module_list, $dependency, $dependency_object)) {
$sanitized_message = Html::decodeEntities(strip_tags($incompatible));
throw new MissingDependencyException("Unable to install theme: $sanitized_message");
}
We're in an API class, calling something that produces UI messages, then stripped the tags from those messages to use them in an exception message.... that seems quite messy!
Remaining tasks
Add a helper method to ThemeInstaller to produce the different exception messages. Remove the trait from ThemeInstaller.
User interface changes
None.
API changes
None.
Data model changes
None
Release notes snippet
N/A