You are here

private function ConfigSorterTest::shuffleDeep in Configuration Split 2.0.x

Shuffle the config to create a random order.

Parameters

mixed $config: The config to shuffle.

Return value

mixed The unordered array.

1 call to ConfigSorterTest::shuffleDeep()
ConfigSorterTest::testSortingUmamiConfig in tests/src/Kernel/ConfigSorterTest.php
Test sorting of config provided by the umami profile.

File

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

Class

ConfigSorterTest
Test sorting.

Namespace

Drupal\Tests\config_split\Kernel

Code

private function shuffleDeep($config) {
  if (!is_array($config) || empty($config)) {
    return $config;
  }
  $keys = array_keys($config);
  shuffle($keys);
  foreach ($keys as $key) {
    $new[$key] = $this
      ->shuffleDeep($config[$key]);
  }
  return $new;
}