You are here

function ConfigImportUITest::testImportSiteUuidValidation in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/config/src/Tests/ConfigImportUITest.php \Drupal\config\Tests\ConfigImportUITest::testImportSiteUuidValidation()

Tests verification of site UUID before importing configuration.

File

core/modules/config/src/Tests/ConfigImportUITest.php, line 256
Contains \Drupal\config\Tests\ConfigImportUITest.

Class

ConfigImportUITest
Tests the user interface for importing/exporting configuration.

Namespace

Drupal\config\Tests

Code

function testImportSiteUuidValidation() {
  $sync = \Drupal::service('config.storage.sync');

  // Create updated configuration object.
  $config_data = $this
    ->config('system.site')
    ->get();

  // Generate a new site UUID.
  $config_data['uuid'] = \Drupal::service('uuid')
    ->generate();
  $sync
    ->write('system.site', $config_data);

  // Verify that there are configuration differences to import.
  $this
    ->drupalGet('admin/config/development/configuration');
  $this
    ->assertText(t('The staged configuration cannot be imported, because it originates from a different site than this site. You can only synchronize configuration between cloned instances of this site.'));
  $this
    ->assertNoFieldById('edit-submit', t('Import all'));
}