You are here

public function ConfigSorterTest::testSortingUmamiConfig in Configuration Split 2.0.x

Test sorting of config provided by the umami profile.

File

tests/src/Kernel/ConfigSorterTest.php, line 21

Class

ConfigSorterTest
Test sorting.

Namespace

Drupal\Tests\config_split\Kernel

Code

public function testSortingUmamiConfig() {

  // Shortcutting the installation of the umami profile.
  // We pretend that the config/install of umami is the active storage.
  $path = $this->container
    ->get('extension.list.profile')
    ->getPath('demo_umami');
  $storage = new FileStorage($path . '/config/install');

  // If this were a test in drupal core we would install umami and all the
  // non-test modules available and get the sorter from the container.
  $sorter = new ConfigSorter($this->container
    ->get('config.typed'), $storage);

  // In a drupal core test we would also sort config that was not available
  // in the active storage. But we don't actually sort that config now.
  foreach ($storage
    ->listAll() as $name) {
    $original = $storage
      ->read($name);
    $shuffled = $this
      ->shuffleDeep($original);
    $sorted = $sorter
      ->sort($name, $shuffled);
    self::assertSame($original, $sorted, "{$name} is sorted again");
  }
}