You are here

public function FieldResolverTest::resolveInternalIncludePathErrorProvider in Drupal 8

Same name and namespace in other branches
  1. 9 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 140

Class

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

Namespace

Drupal\Tests\jsonapi\Kernel\Context

Code

public 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.',
    ],
  ];
}