You are here

protected function IndividualExportImportTest::getSplitExpectationStorage in Configuration Split 2.0.x

Same name and namespace in other branches
  1. 8 tests/src/Kernel/IndividualExportImportTest.php \Drupal\Tests\config_split\Kernel\IndividualExportImportTest::getSplitExpectationStorage()

Get the config which is expected to be split off.

Return value

\Drupal\Core\Config\StorageInterface The config storage with the data the split should have.

3 calls to IndividualExportImportTest::getSplitExpectationStorage()
IndividualExportImportTest::testExportEmptyFiles in tests/src/Kernel/IndividualExportImportTest.php
Test exporting when there is no files in the system.
IndividualExportImportTest::testExportNonEmptyFiles in tests/src/Kernel/IndividualExportImportTest.php
Test exporting when there is already data to be overwritten.
IndividualExportImportTest::testImport in tests/src/Kernel/IndividualExportImportTest.php
Test importing of a split.

File

tests/src/Kernel/IndividualExportImportTest.php, line 209

Class

IndividualExportImportTest
Test the export and import of individual splits.

Namespace

Drupal\Tests\config_split\Kernel

Code

protected function getSplitExpectationStorage() : StorageInterface {
  $expected = new MemoryStorage();
  foreach (array_merge($this
    ->getActiveStorage()
    ->getAllCollectionNames(), [
    StorageInterface::DEFAULT_COLLECTION,
  ]) as $collection) {
    $active = $this
      ->getActiveStorage()
      ->createCollection($collection);
    $expected = $expected
      ->createCollection($collection);
    foreach ($active
      ->listAll() as $name) {
      if (strpos($name, 'config_test') !== FALSE) {

        // Split all config starting with config_test, the module we split.
        $expected
          ->write($name, $active
          ->read($name));
      }
    }
  }
  return $expected;
}