You are here

protected static function ResourceResponseTestTrait::isResourceIdentifier in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/jsonapi/tests/src/Functional/ResourceResponseTestTrait.php \Drupal\Tests\jsonapi\Functional\ResourceResponseTestTrait::isResourceIdentifier()
  2. 10 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 277

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);
}