You are here

public function FieldResolverTest::resolveInternalEntityQueryPathProvider in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/jsonapi/tests/src/Kernel/Context/FieldResolverTest.php \Drupal\Tests\jsonapi\Kernel\Context\FieldResolverTest::resolveInternalEntityQueryPathProvider()

Provides test cases for ::testResolveInternalEntityQueryPath.

File

core/modules/jsonapi/tests/src/Kernel/Context/FieldResolverTest.php, line 178

Class

FieldResolverTest
@coversDefaultClass \Drupal\jsonapi\Context\FieldResolver @group jsonapi

Namespace

Drupal\Tests\jsonapi\Kernel\Context

Code

public function resolveInternalEntityQueryPathProvider() {
  return [
    'config entity as base' => [
      'uuid',
      'id',
      'entity_test_bundle',
      'entity_test_bundle',
    ],
    'config entity as target' => [
      'type.entity:entity_test_bundle.uuid',
      'type.id',
    ],
    'primitive field; variation A' => [
      'field_test1',
      'field_test1',
    ],
    'primitive field; variation B' => [
      'field_test2',
      'field_test2',
    ],
    'entity reference then a primitive field; variation A' => [
      'field_test_ref2.entity:entity_test_with_bundle.field_test1',
      'field_test_ref2.field_test1',
    ],
    'entity reference then a primitive field; variation B' => [
      'field_test_ref2.entity:entity_test_with_bundle.field_test2',
      'field_test_ref2.field_test2',
    ],
    'entity reference then a complex field with property specifier `value`' => [
      'field_test_ref2.entity:entity_test_with_bundle.field_test_text.value',
      'field_test_ref2.field_test_text.value',
    ],
    'entity reference then a complex field with property specifier `format`' => [
      'field_test_ref2.entity:entity_test_with_bundle.field_test_text.format',
      'field_test_ref2.field_test_text.format',
    ],
    'entity reference then no delta with property specifier `id`' => [
      'field_test_ref1.entity:entity_test_with_bundle.uuid',
      'field_test_ref1.id',
    ],
    'entity reference then delta 0 with property specifier `id`' => [
      'field_test_ref1.0.entity:entity_test_with_bundle.uuid',
      'field_test_ref1.0.id',
    ],
    'entity reference then delta 1 with property specifier `id`' => [
      'field_test_ref1.1.entity:entity_test_with_bundle.uuid',
      'field_test_ref1.1.id',
    ],
    'entity reference then no reference property and a complex field with property specifier `value`' => [
      'field_test_ref1.entity:entity_test_with_bundle.field_test_text.value',
      'field_test_ref1.field_test_text.value',
    ],
    'entity reference then a reference property and a complex field with property specifier `value`' => [
      'field_test_ref1.entity.field_test_text.value',
      'field_test_ref1.entity.field_test_text.value',
    ],
    'entity reference then no reference property and a complex field with property specifier `format`' => [
      'field_test_ref1.entity:entity_test_with_bundle.field_test_text.format',
      'field_test_ref1.field_test_text.format',
    ],
    'entity reference then a reference property and a complex field with property specifier `format`' => [
      'field_test_ref1.entity.field_test_text.format',
      'field_test_ref1.entity.field_test_text.format',
    ],
    'entity reference then property specifier `entity:entity_test_with_bundle` then a complex field with property specifier `value`' => [
      'field_test_ref1.entity:entity_test_with_bundle.field_test_text.value',
      'field_test_ref1.entity:entity_test_with_bundle.field_test_text.value',
    ],
    'entity reference with a delta and no reference property then a complex field and property specifier `value`' => [
      'field_test_ref1.0.entity:entity_test_with_bundle.field_test_text.value',
      'field_test_ref1.0.field_test_text.value',
    ],
    'entity reference with a delta and a reference property then a complex field and property specifier `value`' => [
      'field_test_ref1.0.entity.field_test_text.value',
      'field_test_ref1.0.entity.field_test_text.value',
    ],
    'entity reference with no reference property then another entity reference with no reference property a complex field with property specifier `value`' => [
      'field_test_ref1.entity:entity_test_with_bundle.field_test_ref3.entity:entity_test_with_bundle.field_test_text.value',
      'field_test_ref1.field_test_ref3.field_test_text.value',
    ],
    'entity reference with a reference property then another entity reference with no reference property a complex field with property specifier `value`' => [
      'field_test_ref1.entity.field_test_ref3.entity:entity_test_with_bundle.field_test_text.value',
      'field_test_ref1.entity.field_test_ref3.field_test_text.value',
    ],
    'entity reference with no reference property then another entity reference with a reference property a complex field with property specifier `value`' => [
      'field_test_ref1.entity:entity_test_with_bundle.field_test_ref3.entity.field_test_text.value',
      'field_test_ref1.field_test_ref3.entity.field_test_text.value',
    ],
    'entity reference with a reference property then another entity reference with a reference property a complex field with property specifier `value`' => [
      'field_test_ref1.entity.field_test_ref3.entity.field_test_text.value',
      'field_test_ref1.entity.field_test_ref3.entity.field_test_text.value',
    ],
    'entity reference with target bundles then property specifier `entity:entity_test_with_bundle` then a primitive field on multiple bundles' => [
      'field_test_ref1.entity:entity_test_with_bundle.field_test3',
      'field_test_ref1.entity:entity_test_with_bundle.field_test3',
    ],
    'entity reference without target bundles then property specifier `entity:entity_test_with_bundle` then a primitive field on a single bundle' => [
      'field_test_ref2.entity:entity_test_with_bundle.field_test1',
      'field_test_ref2.entity:entity_test_with_bundle.field_test1',
    ],
    'entity reference without target bundles then property specifier `entity:entity_test_with_bundle` then a primitive field on multiple bundles' => [
      'field_test_ref3.entity:entity_test_with_bundle.field_test3',
      'field_test_ref3.entity:entity_test_with_bundle.field_test3',
      'entity_test_with_bundle',
      'bundle2',
    ],
    'entity reference without target bundles then property specifier `entity:entity_test_with_bundle` then a primitive field on a single bundle starting from a different resource type' => [
      'field_test_ref3.entity:entity_test_with_bundle.field_test2',
      'field_test_ref3.entity:entity_test_with_bundle.field_test2',
      'entity_test_with_bundle',
      'bundle3',
    ],
    'entity reference then property specifier `entity:entity_test_with_bundle` then another entity reference before a primitive field' => [
      'field_test_ref1.entity:entity_test_with_bundle.field_test_ref3.entity:entity_test_with_bundle.field_test2',
      'field_test_ref1.entity:entity_test_with_bundle.field_test_ref3.field_test2',
    ],
  ];
}