You are here

public function FieldResolverTest::resolveInternalIncludePathErrorProvider in JSON:API 8.2

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

Provides test cases for ::testResolveInternalIncludePathError.

File

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

Class

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

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