Verified Commit 54096101 authored by Lee Rowlands's avatar Lee Rowlands
Browse files

Issue #3385934 by phthlaap, joegraduate, useernamee, alexpott: The...

Issue #3385934 by phthlaap, joegraduate, useernamee, alexpott: The configuration synchronization page encounters errors when core.extension.yml is missing in the config/sync directory

(cherry picked from commit 96a211c7)
parent 7437958d
Loading
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -314,11 +314,11 @@ function field_config_import_steps_alter(&$sync_steps, ConfigImporter $config_im
 * @see \Drupal\field\ConfigImporterFieldPurger
 */
function field_form_config_admin_import_form_alter(&$form, FormStateInterface $form_state) {
  // Only display the message when there is a storage comparer available and the
  // form is not submitted.
  // Only display the message when core.extension is available in the source
  // storage and the form is not submitted.
  $user_input = $form_state->getUserInput();
  $storage_comparer = $form_state->get('storage_comparer');
  if ($storage_comparer && empty($user_input)) {
  if ($storage_comparer?->getSourceStorage()->exists('core.extension') && empty($user_input)) {
    $field_storages = ConfigImporterFieldPurger::getFieldStoragesToPurge(
      $storage_comparer->getSourceStorage()->read('core.extension'),
      $storage_comparer->getChangelist('delete')
+14 −0
Original line number Diff line number Diff line
@@ -130,4 +130,18 @@ public function testImportDeleteUninstall() {
    $this->assertFalse(isset($deleted_storages[$field_storage->uuid()]), 'Text field has been completed removed from the system.');
  }

  /**
   * Tests if the synchronization form is available when the core.extension.yml is missing.
   */
  public function testSynchronizeForm(): void {
    $sync = $this->container->get('config.storage.sync');
    $this->copyConfig($this->container->get('config.storage'), $sync);

    $sync->delete('core.extension');
    $this->drupalGet('admin/config/development/configuration');
    $assertSession = $this->assertSession();
    $this->assertSession()->elementExists('css', 'input[value="Import all"]')->click();
    $assertSession->pageTextContains('The core.extension configuration does not exist.');
  }

}