You are here

protected static function ResourceTestBase::sortErrors in JSON:API 8

Sorts an error array.

Parameters

array $errors: An array of JSON API error object to be sorted by ID.

1 call to ResourceTestBase::sortErrors()
ResourceTestBase::assertSameDocument in tests/src/Functional/ResourceTestBase.php
Asserts that an expected document matches the response body.

File

tests/src/Functional/ResourceTestBase.php, line 2410

Class

ResourceTestBase
Subclass this for every JSON API resource type.

Namespace

Drupal\Tests\jsonapi\Functional

Code

protected static function sortErrors(array &$errors) {
  usort($errors, function ($a, $b) {
    return strcmp($a['id'], $b['id']);
  });
}