You are here

public function ConfigExportStorageTest::testExportStorage in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/KernelTests/Core/Config/ConfigExportStorageTest.php \Drupal\KernelTests\Core\Config\ConfigExportStorageTest::testExportStorage()
  2. 9 core/tests/Drupal/KernelTests/Core/Config/ConfigExportStorageTest.php \Drupal\KernelTests\Core\Config\ConfigExportStorageTest::testExportStorage()

Tests configuration override.

File

core/tests/Drupal/KernelTests/Core/Config/ConfigExportStorageTest.php, line 29

Class

ConfigExportStorageTest
Tests configuration export storage.

Namespace

Drupal\KernelTests\Core\Config

Code

public function testExportStorage() {

  /** @var \Drupal\Core\Config\StorageInterface $active */
  $active = $this->container
    ->get('config.storage');

  /** @var \Drupal\Core\Config\StorageInterface $export */
  $export = $this->container
    ->get('config.storage.export');

  // Test that the active and the export storage contain the same config.
  $this
    ->assertNotEmpty($active
    ->listAll());
  $this
    ->assertEquals($active
    ->listAll(), $export
    ->listAll());
  foreach ($active
    ->listAll() as $name) {
    $this
      ->assertEquals($active
      ->read($name), $export
      ->read($name));
  }

  // Test that the export storage is read-only.
  $this
    ->expectException(\BadMethodCallException::class);
  $export
    ->deleteAll();
}