You are here

public function ConfigFilterStorageFactoryTest::testServiceProvider in Config Filter 8

Test that the config.storage.sync is decorated with the filtering version.

File

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

Class

ConfigFilterStorageFactoryTest
Storage factory test.

Namespace

Drupal\Tests\config_filter\Kernel

Code

public function testServiceProvider() {

  // Config Filter makes the sync storage a filtered storage.
  $this
    ->assertInstanceOf(FilteredStorageInterface::class, $this->container
    ->get('config.storage.sync'));

  // Export the configuration. The pirate filter changes system.site.
  $this
    ->copyConfig($this->container
    ->get('config.storage'), $this->container
    ->get('config.storage.sync'));

  // The pirate filter changes the system.site when importing.
  $this
    ->assertEquals([
    'system.site',
  ], $this
    ->configImporter()
    ->getStorageComparer()
    ->getChangelist('update'));
  $this
    ->assertEmpty($this
    ->configImporter()
    ->getStorageComparer()
    ->getChangelist('create'));
  $this
    ->assertEmpty($this
    ->configImporter()
    ->getStorageComparer()
    ->getChangelist('delete'));
  $this
    ->assertEmpty($this
    ->configImporter()
    ->getStorageComparer()
    ->getChangelist('rename'));
  $config = $this
    ->config('system.site')
    ->getRawData();
  $config['name'] .= ' Arrr';
  $config['slogan'] .= ' Arrr';
  $this
    ->assertEquals($config, $this->container
    ->get('config.storage.sync')
    ->read('system.site'));
}