function FieldResolverTest::resolveInternalEntityQueryPathErrorProvider

Same name in other branches
  1. 9 core/modules/jsonapi/tests/src/Kernel/Context/FieldResolverTest.php \Drupal\Tests\jsonapi\Kernel\Context\FieldResolverTest::resolveInternalEntityQueryPathErrorProvider()
  2. 10 core/modules/jsonapi/tests/src/Kernel/Context/FieldResolverTest.php \Drupal\Tests\jsonapi\Kernel\Context\FieldResolverTest::resolveInternalEntityQueryPathErrorProvider()
  3. 11.x core/modules/jsonapi/tests/src/Kernel/Context/FieldResolverTest.php \Drupal\Tests\jsonapi\Kernel\Context\FieldResolverTest::resolveInternalEntityQueryPathErrorProvider()

Provides test cases for ::testResolveInternalEntityQueryPathError.

File

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

Class

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

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.',
        ],
        'entity reference then a complex field with no property specifier' => [
            'entity_test_with_bundle',
            'bundle1',
            'field_test_ref2.field_test_text',
            'Invalid nested filtering. The field `field_test_text`, given in the path `field_test_ref2.field_test_text` is incomplete, it must end with one of the following specifiers: `value`, `format`, `processed`.',
        ],
        'entity reference then no delta with property specifier `target_id`' => [
            'entity_test_with_bundle',
            'bundle1',
            'field_test_ref1.target_id',
            'Invalid nested filtering. The property `target_id`, given in the path `field_test_ref1.target_id`, does not exist. Filter by `field_test_ref1`, not `field_test_ref1.target_id` (the JSON:API module elides property names from single-property fields).',
        ],
        'entity reference then delta 0 with property specifier `target_id`' => [
            'entity_test_with_bundle',
            'bundle1',
            'field_test_ref1.0.target_id',
            'Invalid nested filtering. The property `target_id`, given in the path `field_test_ref1.0.target_id`, does not exist. Filter by `field_test_ref1.0`, not `field_test_ref1.0.target_id` (the JSON:API module elides property names from single-property fields).',
        ],
        'entity reference then delta 1 with property specifier `target_id`' => [
            'entity_test_with_bundle',
            'bundle1',
            'field_test_ref1.1.target_id',
            'Invalid nested filtering. The property `target_id`, given in the path `field_test_ref1.1.target_id`, does not exist. Filter by `field_test_ref1.1`, not `field_test_ref1.1.target_id` (the JSON:API module elides property names from single-property fields).',
        ],
        'entity reference then no reference property then a complex field' => [
            'entity_test_with_bundle',
            'bundle1',
            'field_test_ref1.field_test_text',
            'Invalid nested filtering. The field `field_test_text`, given in the path `field_test_ref1.field_test_text` is incomplete, it must end with one of the following specifiers: `value`, `format`, `processed`.',
        ],
        'entity reference then reference property then a complex field' => [
            'entity_test_with_bundle',
            'bundle1',
            'field_test_ref1.entity.field_test_text',
            'Invalid nested filtering. The field `field_test_text`, given in the path `field_test_ref1.entity.field_test_text` is incomplete, it must end with one of the following specifiers: `value`, `format`, `processed`.',
        ],
        'entity reference then property specifier `entity:entity_test_with_bundle` then a complex field' => [
            'entity_test_with_bundle',
            'bundle1',
            'field_test_ref1.entity:entity_test_with_bundle.field_test_text',
            'Invalid nested filtering. The field `field_test_text`, given in the path `field_test_ref1.entity:entity_test_with_bundle.field_test_text` is incomplete, it must end with one of the following specifiers: `value`, `format`, `processed`.',
        ],
    ];
}

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