You are here

public function FieldResolverTest::testResolveInternalIncludePathError 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::testResolveInternalIncludePathError()

Expects an error when an invalid field is provided for include.

@covers ::resolveInternalIncludePath @dataProvider resolveInternalIncludePathErrorProvider

Parameters

string $entity_type: The entity type for which to test field resolution.

string $bundle: The entity bundle for which to test field resolution.

string $external_path: The external field path to resolve.

string $expected_message: (optional) An expected exception message.

File

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

Class

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

Namespace

Drupal\Tests\jsonapi\Kernel\Context

Code

public function testResolveInternalIncludePathError($entity_type, $bundle, $external_path, $expected_message = '') {
  $path_parts = explode('.', $external_path);
  $this
    ->setExpectedException(CacheableBadRequestHttpException::class, $expected_message);
  $resource_type = $this->resourceTypeRepository
    ->get($entity_type, $bundle);
  $this->sut
    ->resolveInternalIncludePath($resource_type, $path_parts);
}