diff -u b/core/lib/Drupal/Core/Config/ExtensionInstallStorage.php b/core/lib/Drupal/Core/Config/ExtensionInstallStorage.php --- b/core/lib/Drupal/Core/Config/ExtensionInstallStorage.php +++ b/core/lib/Drupal/Core/Config/ExtensionInstallStorage.php @@ -56,7 +56,7 @@ * @param \Drupal\Core\Extension\ProfileHandlerInterface $profile_handler * (optional) The profile handler. */ - public function __construct(StorageInterface $config_storage, $directory = self::CONFIG_INSTALL_DIRECTORY, $collection = StorageInterface::DEFAULT_COLLECTION, $include_profile = TRUE, $profile = NULL, ProfileHandlerInterface $profile_handler) { + public function __construct(StorageInterface $config_storage, $directory = self::CONFIG_INSTALL_DIRECTORY, $collection = StorageInterface::DEFAULT_COLLECTION, $include_profile = TRUE, $profile = NULL, ProfileHandlerInterface $profile_handler = NULL) { parent::__construct($directory, $collection, $profile_handler); $this->configStorage = $config_storage; $this->includeProfile = $include_profile; diff -u b/core/lib/Drupal/Core/Extension/ProfileHandler.php b/core/lib/Drupal/Core/Extension/ProfileHandler.php --- b/core/lib/Drupal/Core/Extension/ProfileHandler.php +++ b/core/lib/Drupal/Core/Extension/ProfileHandler.php @@ -71,7 +71,7 @@ public function __construct($root, InfoParserInterface $info_parser, ExtensionDiscovery $extension_discovery = NULL) { $this->root = $root; $this->infoParser = $info_parser; - $this->extensionDiscovery = $extension_discovery ?: new ExtensionDiscovery($root); + $this->extensionDiscovery = $extension_discovery ?: new ExtensionDiscovery($root, TRUE, NULL, NULL, $this); } /** @@ -91,12 +91,11 @@ // @todo Remove as part of https://www.drupal.org/node/2186491. $modules_cache = &drupal_static('system_rebuild_module_data'); if (!$this->scanCache && !isset($modules_cache)) { - $listing = $this->getExtensionDiscovery(); // Find installation profiles. This needs to happen before performing a // module scan as the module scan requires knowing what the active profile // is. // @todo Remove as part of https://www.drupal.org/node/2186491. - $profiles = $listing->scan('profile'); + $profiles = $this->extensionDiscovery->scan('profile'); foreach ($profiles as $profile_name => $extension) { // Prime the drupal_get_filename() static cache with the profile info // file location so we can use drupal_get_path() on the active profile @@ -126,7 +125,8 @@ 'php' => DRUPAL_MINIMUM_PHP, 'base profile' => [ 'name' => '', - 'excluded_dependencies' => [] + 'excluded_dependencies' => [], + 'excluded_themes' => [], ], ]; @@ -139,6 +139,7 @@ $info['base profile'] = [ 'name' => $info['base profile'], 'excluded_dependencies' => [], + 'excluded_themes' => [], ]; } @@ -154,6 +155,13 @@ $info['dependencies'] = array_diff($info['dependencies'], $info['base profile']['excluded_dependencies']); // Ensure there's no circular dependency. $info['dependencies'] = array_diff($info['dependencies'], [$profile]); + + // Ensure all themes are cleanly merged. + $info['themes'] = array_unique(array_merge($info['themes'], $base_info['themes'])); + // Apply excluded themes. + $info['themes'] = array_diff($info['themes'], $info['base profile']['excluded_themes']); + // Ensure each theme is listed only once. + $info['themes'] = array_unique($info['themes']); } $profile_list[$profile] = $profile; $info['profile_list'] = $profile_list; diff -u b/core/profiles/testing_inherited/testing_inherited.info.yml b/core/profiles/testing_inherited/testing_inherited.info.yml --- b/core/profiles/testing_inherited/testing_inherited.info.yml +++ b/core/profiles/testing_inherited/testing_inherited.info.yml @@ -9,6 +9,12 @@ - name: minimal + name: testing excluded_dependencies: - - dblog + - page_cache + excluded_themes: + - classy dependencies: + - block - config + +themes: + - stable diff -u b/core/profiles/testing_inherited/tests/src/Functional/InheritedProfileTest.php b/core/profiles/testing_inherited/tests/src/Functional/InheritedProfileTest.php --- b/core/profiles/testing_inherited/tests/src/Functional/InheritedProfileTest.php +++ b/core/profiles/testing_inherited/tests/src/Functional/InheritedProfileTest.php @@ -2,6 +2,8 @@ namespace Drupal\Tests\testing_inherited\Functional; +use Drupal\block\BlockInterface; +use Drupal\block\Entity\Block; use Drupal\Tests\BrowserTestBase; /** @@ -20,14 +22,19 @@ * Tests inherited installation profile. */ function testInheritedProfile() { - $this->drupalGet(''); - // Check the login block is present. - $this->assertSession()->linkExists(t('Create new account')); - $this->assertSession()->statusCodeEquals(200); + // Check that the stable_login block exists. + $this->assertInstanceOf(BlockInterface::class, Block::load('stable_login')); + + // Check that stable is the default theme. + $this->assertEquals('stable', $this->config('system.theme')->get('default')); // Check the excluded_dependencies flag on installation profiles. $this->assertTrue(\Drupal::moduleHandler()->moduleExists('config')); - $this->assertFalse(\Drupal::moduleHandler()->moduleExists('dblog')); + $this->assertFalse(\Drupal::moduleHandler()->moduleExists('page_cache')); + + // Check that all themes were installed, except excluded ones. + $this->assertTrue(\Drupal::service('theme_handler')->themeExists('stable')); + $this->assertFalse(\Drupal::service('theme_handler')->themeExists('classy')); } } only in patch2: unchanged: --- /dev/null +++ b/core/profiles/testing_inherited/config/install/block.block.stable_login.yml @@ -0,0 +1,19 @@ +langcode: en +status: true +dependencies: + module: + - user + theme: + - stable +id: stable_login +theme: stable +region: sidebar_first +weight: 0 +provider: null +plugin: user_login_block +settings: + id: user_login_block + label: 'User login' + provider: user + label_display: visible +visibility: { } only in patch2: unchanged: --- /dev/null +++ b/core/profiles/testing_inherited/config/install/system.theme.yml @@ -0,0 +1,2 @@ +# @todo: Remove this file in https://www.drupal.org/node/2352949 +default: stable