You are here

public function ConfigFilterStorageFactoryTest::testStorageTransformation in Config Filter 8.2

Tests that config is correctly transformed.

File

tests/src/Kernel/ConfigFilterStorageFactoryTest.php, line 37

Class

ConfigFilterStorageFactoryTest
Class ConfigFilterStorageFactoryTest.

Namespace

Drupal\Tests\config_filter\Kernel

Code

public function testStorageTransformation() {

  // Export the configuration.
  $sync_storage = $this->container
    ->get('config.storage.sync');
  $this
    ->copyConfig($this->container
    ->get('config.storage.export'), $sync_storage);
  $transformed_storage = $this->container
    ->get('config.import_transformer')
    ->transform($sync_storage);
  $comparer = new StorageComparer($transformed_storage, $this->container
    ->get('config.storage'));
  $comparer
    ->createChangelist();

  // The pirate filter changes the system.site when importing.
  $this
    ->assertEquals([
    'system.site',
    'core.extension',
  ], $comparer
    ->getChangelist('update'));
  $this
    ->assertEmpty($comparer
    ->getChangelist('create'));
  $this
    ->assertEmpty($comparer
    ->getChangelist('delete'));
  $this
    ->assertEmpty($comparer
    ->getChangelist('rename'));
  $config = $this
    ->config('system.site')
    ->getRawData();
  $config['name'] .= ' Arrr';
  $config['slogan'] .= ' Arrr';
  $this
    ->assertEquals($config, $transformed_storage
    ->read('system.site'));
}