Skip to content
Snippets Groups Projects
Unverified Commit e172a37a authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2855026 by phenaproxima, trobey, HaiNguyen007, alexpott, Taran2L,...

Issue #2855026 by phenaproxima, trobey, HaiNguyen007, alexpott, Taran2L, -enzo-, Jo Fitzgerald, tucho, DamienMcKenna, andypost, tobiasb, dawehner, larowlan: Installation profiles do not support project:module format for dependencies
parent 398885e1
No related branches found
No related tags found
No related merge requests found
......@@ -11,6 +11,7 @@
use Drupal\Component\Utility\OpCodeCache;
use Drupal\Component\Utility\UrlHelper;
use Drupal\Core\Extension\ExtensionDiscovery;
use Drupal\Core\Extension\ModuleHandler;
use Drupal\Core\Site\Settings;
/**
......@@ -1113,6 +1114,16 @@ function install_profile_info($profile, $langcode = 'en') {
$info = \Drupal::service('info_parser')->parse("$profile_path/$profile.info.yml");
$info += $defaults;
// Convert dependencies in [project:module] format.
$info['dependencies'] = array_map(function ($dependency) {
return ModuleHandler::parseDependency($dependency)['name'];
}, $info['dependencies']);
// Convert install key in [project:module] format.
$info['install'] = array_map(function ($dependency) {
return ModuleHandler::parseDependency($dependency)['name'];
}, $info['install']);
// drupal_required_modules() includes the current profile as a dependency.
// Remove that dependency, since a module cannot depend on itself.
$required = array_diff(drupal_required_modules(), [$profile]);
......
......@@ -5,11 +5,11 @@
use Drupal\KernelTests\KernelTestBase;
/**
* Tests that we handle the absence of a module dependency during install.
* Tests that we handle module dependency resolution during install.
*
* @group Installer
*/
class InstallerMissingDependenciesTest extends KernelTestBase {
class InstallerDependenciesResolutionTest extends KernelTestBase {
/**
* {@inheritdoc}
......@@ -19,7 +19,7 @@ class InstallerMissingDependenciesTest extends KernelTestBase {
/**
* Verifies that the exception message in the profile step is correct.
*/
public function testSetUpWithMissingDependencies() {
public function testDependenciesResolution() {
// Prime the drupal_get_filename() static cache with the location of the
// testing profile as it is not the currently active profile and we don't
// yet have any cached way to retrieve its location.
......@@ -32,8 +32,11 @@ public function testSetUpWithMissingDependencies() {
]);
$message = $info['required_modules']['description']->render();
$this->assertContains('Fictional', $message);
$this->assertContains('Missing_module1', $message);
$this->assertContains('Missing_module2', $message);
$this->assertNotContains('Block', $message);
$this->assertNotContains('Node', $message);
}
}
......@@ -7,7 +7,7 @@ hidden: true
install:
# Enable page_cache and dynamic_page_cache in testing, to ensure that as many
# tests as possible run with them enabled.
- page_cache
- drupal:page_cache
- dynamic_page_cache
# @todo: Remove this in https://www.drupal.org/node/2352949
themes:
......
......@@ -5,6 +5,9 @@ version: VERSION
core: 8.x
hidden: true
install:
- block
- drupal:node
- drupal:fictional
- missing_module1
- missing_module2
keep_english: true
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment