function ResourceResponseTestTrait::isResourceIdentifier

Same name in other branches
  1. 9 core/modules/jsonapi/tests/src/Functional/ResourceResponseTestTrait.php \Drupal\Tests\jsonapi\Functional\ResourceResponseTestTrait::isResourceIdentifier()
  2. 8.9.x core/modules/jsonapi/tests/src/Functional/ResourceResponseTestTrait.php \Drupal\Tests\jsonapi\Functional\ResourceResponseTestTrait::isResourceIdentifier()
  3. 11.x core/modules/jsonapi/tests/src/Functional/ResourceResponseTestTrait.php \Drupal\Tests\jsonapi\Functional\ResourceResponseTestTrait::isResourceIdentifier()

Checks if a given array is a resource identifier.

Parameters

array $data: An array to check.

Return value

bool TRUE if the array has a type and ID, FALSE otherwise.

4 calls to ResourceResponseTestTrait::isResourceIdentifier()
ResourceResponseTestTrait::getResourceLink in core/modules/jsonapi/tests/src/Functional/ResourceResponseTestTrait.php
Creates an individual resource link for a given resource identifier.
ResourceResponseTestTrait::toCollectionResourceResponse in core/modules/jsonapi/tests/src/Functional/ResourceResponseTestTrait.php
Merges individual responses into a collection response.
ResourceTestBase::decorateExpectedResponseForIncludedFields in core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php
Decorates the expected response with included data and cache metadata.
ResourceTestBase::getExpectedRelatedResponse in core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php
Builds an expected related ResourceResponse for the given field.

File

core/modules/jsonapi/tests/src/Functional/ResourceResponseTestTrait.php, line 279

Class

ResourceResponseTestTrait
Utility methods for handling resource responses.

Namespace

Drupal\Tests\jsonapi\Functional

Code

protected static function isResourceIdentifier(array $data) {
    return array_key_exists('type', $data) && array_key_exists('id', $data);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.