diff -u b/core/lib/Drupal/Core/Config/ConfigInstaller.php b/core/lib/Drupal/Core/Config/ConfigInstaller.php --- b/core/lib/Drupal/Core/Config/ConfigInstaller.php +++ b/core/lib/Drupal/Core/Config/ConfigInstaller.php @@ -157,7 +157,7 @@ * {@inheritdoc} */ public function installOptionalConfig(StorageInterface $storage = NULL, $dependency = []) { - $profile = $this->drupalGetPath('module', $this->drupalGetProfile()); + $profile = $this->drupalGetProfile(); if (!$storage) { // Search the install profile's optional configuration too. $storage = new ExtensionInstallStorage($this->getActiveStorages(StorageInterface::DEFAULT_COLLECTION), InstallStorage::CONFIG_OPTIONAL_DIRECTORY, StorageInterface::DEFAULT_COLLECTION, TRUE); @@ -166,9 +166,14 @@ } elseif (isset($profile)) { // Creates a profile storage to search for overrides. - $profile_install_path = $profile . '/' . InstallStorage::CONFIG_OPTIONAL_DIRECTORY; + $profile_install_path = $this->drupalGetPath('module', $profile . '/' . InstallStorage::CONFIG_OPTIONAL_DIRECTORY; $profile_storage = new FileStorage($profile_install_path, StorageInterface::DEFAULT_COLLECTION); } + else { + // Profile has not been set yet. For example during the first steps of the + // installer or during unit tests. + $profile_storage = NULL; + } $collection_info = $this->configManager->getConfigCollectionInfo(); $enabled_extensions = $this->getEnabledExtensions();