function ResourceTestBase::recursiveKSort
Same name in this branch
- 10 core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\jsonapi\Functional\ResourceTestBase::recursiveKsort()
Same name in other branches
- 9 core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\jsonapi\Functional\ResourceTestBase::recursiveKsort()
- 9 core/modules/rest/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\rest\Functional\ResourceTestBase::recursiveKSort()
- 8.9.x core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\jsonapi\Functional\ResourceTestBase::recursiveKsort()
- 8.9.x core/modules/rest/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\rest\Functional\ResourceTestBase::recursiveKSort()
- 11.x core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\jsonapi\Functional\ResourceTestBase::recursiveKsort()
- 11.x core/modules/rest/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\rest\Functional\ResourceTestBase::recursiveKSort()
Recursively sorts an array by key.
Parameters
array $array: An array to sort.
4 calls to ResourceTestBase::recursiveKSort()
- EntityResourceTestBase::testGet in core/
modules/ rest/ tests/ src/ Functional/ EntityResource/ EntityResourceTestBase.php - Tests a GET request for an entity, plus edge cases to ensure good DX.
- FileUploadResourceTestBase::assertResponseData in core/
modules/ rest/ tests/ src/ Functional/ FileUploadResourceTestBase.php - Asserts expected normalized data matches response data.
- MediaResourceTestBase::uploadFile in core/
modules/ media/ tests/ src/ Functional/ Rest/ MediaResourceTestBase.php - Tests the 'file_upload' REST resource plugin.
- TermResourceTestBase::testGetTermWithParent in core/
modules/ taxonomy/ tests/ src/ Functional/ Rest/ TermResourceTestBase.php - Tests GETting a term with a parent term other than the default <root> (0).
File
-
core/
modules/ rest/ tests/ src/ Functional/ ResourceTestBase.php, line 492
Class
- ResourceTestBase
- Subclass this for every REST resource, every format and every auth provider.
Namespace
Drupal\Tests\rest\FunctionalCode
protected static function recursiveKSort(array &$array) {
// First, sort the main array.
ksort($array);
// Then check for child arrays.
foreach ($array as $key => &$value) {
if (is_array($value)) {
static::recursiveKSort($value);
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.