You are here

protected function MediaTest::getExpectedGetRelationshipDocumentData in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/jsonapi/tests/src/Functional/MediaTest.php \Drupal\Tests\jsonapi\Functional\MediaTest::getExpectedGetRelationshipDocumentData()
  2. 9 core/modules/jsonapi/tests/src/Functional/MediaTest.php \Drupal\Tests\jsonapi\Functional\MediaTest::getExpectedGetRelationshipDocumentData()

File

core/modules/jsonapi/tests/src/Functional/MediaTest.php, line 369

Class

MediaTest
JSON:API integration test for the "Media" content entity type.

Namespace

Drupal\Tests\jsonapi\Functional

Code

protected function getExpectedGetRelationshipDocumentData($relationship_field_name, EntityInterface $entity = NULL) {
  $data = parent::getExpectedGetRelationshipDocumentData($relationship_field_name, $entity);
  switch ($relationship_field_name) {
    case 'thumbnail':
      $data['meta'] = [
        'alt' => '',
        'width' => 180,
        'height' => 180,
        'title' => NULL,
      ] + $data['meta'];
      return $data;
    case 'field_media_file':
      $data['meta'] = [
        'description' => NULL,
        'display' => NULL,
      ] + $data['meta'];
      return $data;
    default:
      return $data;
  }
}