function FieldResolverTest::resolveInternalIncludePathErrorProvider

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

Provides test cases for ::testResolveInternalIncludePathError.

File

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

Class

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

Namespace

Drupal\Tests\jsonapi\Kernel\Context

Code

public static function resolveInternalIncludePathErrorProvider() {
    return [
        // Should fail because none of these bundles have these fields.
[
            'entity_test_with_bundle',
            'bundle1',
            'host.fail!!.deep',
        ],
        [
            'entity_test_with_bundle',
            'bundle2',
            'field_test_ref2',
        ],
        [
            'entity_test_with_bundle',
            'bundle1',
            'field_test_ref3',
        ],
        // Should fail because the nested fields don't exist on the targeted
        // resource types.
[
            'entity_test_with_bundle',
            'bundle1',
            'field_test_ref1.field_test1',
        ],
        [
            'entity_test_with_bundle',
            'bundle1',
            'field_test_ref1.field_test2',
        ],
        [
            'entity_test_with_bundle',
            'bundle1',
            'field_test_ref1.field_test_ref1',
        ],
        [
            'entity_test_with_bundle',
            'bundle1',
            'field_test_ref1.field_test_ref2',
        ],
        // Should fail because the nested fields is not a valid relationship
        // field name.
[
            'entity_test_with_bundle',
            'bundle1',
            'field_test1',
            '`field_test1` is not a valid relationship field name.',
        ],
        // Should fail because the nested fields is not a valid include path.
[
            'entity_test_with_bundle',
            'bundle1',
            'field_test_ref1.field_test3',
            '`field_test_ref1.field_test3` is not a valid include path.',
        ],
    ];
}

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