You are here

public function FieldResolverTest::resolveInternalEntityQueryPathErrorProvider in JSON:API 8

Same name and namespace in other branches
  1. 8.2 tests/src/Kernel/Context/FieldResolverTest.php \Drupal\Tests\jsonapi\Kernel\Context\FieldResolverTest::resolveInternalEntityQueryPathErrorProvider()

Provides test cases for ::testResolveInternalEntityQueryPathError.

File

tests/src/Kernel/Context/FieldResolverTest.php, line 247

Class

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

Namespace

Drupal\Tests\jsonapi\Kernel\Context

Code

public function resolveInternalEntityQueryPathErrorProvider() {
  return [
    'nested fields' => [
      'entity_test_with_bundle',
      'bundle1',
      'none.of.these.exist',
    ],
    'field does not exist on bundle' => [
      'entity_test_with_bundle',
      'bundle2',
      'field_test_ref2',
    ],
    'field does not exist on different bundle' => [
      'entity_test_with_bundle',
      'bundle1',
      'field_test_ref3',
    ],
    'field does not exist on targeted bundle' => [
      'entity_test_with_bundle',
      'bundle1',
      'field_test_ref1.field_test1',
    ],
    'different field does not exist on same targeted bundle' => [
      'entity_test_with_bundle',
      'bundle1',
      'field_test_ref1.field_test2',
    ],
    'entity reference field does not exist on targeted bundle' => [
      'entity_test_with_bundle',
      'bundle1',
      'field_test_ref1.field_test_ref1',
    ],
    'different entity reference field does not exist on same targeted bundle' => [
      'entity_test_with_bundle',
      'bundle1',
      'field_test_ref1.field_test_ref2',
    ],
    'message correctly identifies missing field' => [
      'entity_test_with_bundle',
      'bundle1',
      'field_test_ref1.entity:entity_test_with_bundle.field_test1',
      'Invalid nested filtering. The field `field_test1`, given in the path `field_test_ref1.entity:entity_test_with_bundle.field_test1`, does not exist.',
    ],
    'message correctly identifies different missing field' => [
      'entity_test_with_bundle',
      'bundle1',
      'field_test_ref1.entity:entity_test_with_bundle.field_test2',
      'Invalid nested filtering. The field `field_test2`, given in the path `field_test_ref1.entity:entity_test_with_bundle.field_test2`, does not exist.',
    ],
    'message correctly identifies missing entity reference field' => [
      'entity_test_with_bundle',
      'bundle2',
      'field_test_ref1.entity:entity_test_with_bundle.field_test2',
      'Invalid nested filtering. The field `field_test_ref1`, given in the path `field_test_ref1.entity:entity_test_with_bundle.field_test2`, does not exist.',
    ],
  ];
}