public function ImageUpgradePathTest::sortByKey

Sorts all keys in configuration data.

Since we can not be sure of the order of the UUID's generated by _image_update_get_style_with_effects() we need to sort the data in order to compare it with data saved in the config system.

Parameters

array $data: An associative array to sort recursively by key name.

Return value

array A sorted array.

1 call to ImageUpgradePathTest::sortByKey()
ImageUpgradePathTest::testImageStyleUpgrade in drupal/core/modules/system/lib/Drupal/system/Tests/Upgrade/ImageUpgradePathTest.php
Tests that custom and overridden image styles have been upgraded.

File

drupal/core/modules/system/lib/Drupal/system/Tests/Upgrade/ImageUpgradePathTest.php, line 101
Definition of Drupal\system\Tests\Upgrade\ImageUpgradePathTest.

Class

ImageUpgradePathTest
Test upgrade of overridden and custom image styles.

Namespace

Drupal\system\Tests\Upgrade

Code

public function sortByKey(array $data) {
  ksort($data);
  foreach ($data as &$value) {
    if (is_array($value)) {
      $this
        ->sortByKey($value);
    }
  }
  return $data;
}