You are here

protected function ConfigInstallerTestBase::assertNoSynDifferences in Configuration installer 8

Ensures that the sync and active configuration match.

Return value

bool TRUE if sync and active configuration match, FALSE if not.

1 call to ConfigInstallerTestBase::assertNoSynDifferences()
ConfigInstallerTestBase::setUp in tests/src/Functional/ConfigInstallerTestBase.php

File

tests/src/Functional/ConfigInstallerTestBase.php, line 184

Class

ConfigInstallerTestBase
Provides functionality for testing the config_installer profile.

Namespace

Drupal\Tests\config_installer\Functional

Code

protected function assertNoSynDifferences() {
  $sync = $this->container
    ->get('config.storage.sync');
  $active = $this->container
    ->get('config.storage');

  // Ensure that we have no configuration changes to import.
  $storage_comparer = new StorageComparer($sync, $active, $this->container
    ->get('config.manager'));
  $changelist = $storage_comparer
    ->createChangelist()
    ->getChangelist();

  // system.mail is changed by \Drupal\simpletest\InstallerTestBase::setUp()
  // this is a good idea because it prevents tests emailling.
  $key = array_search('system.mail', $changelist['update'], TRUE);
  if ($key !== FALSE) {
    unset($changelist['update'][$key]);
  }
  $return = $this
    ->assertIdentical($changelist, $storage_comparer
    ->getEmptyChangelist());

  // Output proper diffs.
  $controller = ConfigController::create($this->container);
  foreach ($changelist['update'] as $config_name) {
    $diff = $controller
      ->diff($config_name);
    $this
      ->verbose(\Drupal::service('renderer')
      ->renderPlain($diff));
  }
  return $return;
}