function ConfigImportCommandTest::testImportSiteUuidValidation

Tests verification of site UUID before importing configuration.

See also

\Drupal\Tests\config\Functional\ConfigImportUITest::testImportSiteUuidValidation()

File

core/tests/Drupal/FunctionalTests/Core/Config/ConfigImportCommandTest.php, line 297

Class

ConfigImportCommandTest
Tests the 'config:import' command.

Namespace

Drupal\FunctionalTests\Core\Config

Code

public function testImportSiteUuidValidation() : void {
  $sync = $this->container
    ->get('config.storage.sync');
  $config_data = $this->config('system.site')
    ->get();
  $config_data['uuid'] = $this->container
    ->get('uuid')
    ->generate();
  $sync->write('system.site', $config_data);
  $tester = $this->commandTester();
  $code = $tester->execute([
    '--yes' => TRUE,
  ]);
  self::assertSame(Command::FAILURE, $code);
  self::assertStringContainsString('Site UUID in source storage does not match the target storage', $tester->getDisplay());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.