function FieldResolverTest::testResolveInternalEntityQueryPathError

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

Expects an error when an invalid field is provided for filter and sort.

@covers ::resolveInternalEntityQueryPath @dataProvider resolveInternalEntityQueryPathErrorProvider

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

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

Class

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

Namespace

Drupal\Tests\jsonapi\Kernel\Context

Code

public function testResolveInternalEntityQueryPathError($entity_type, $bundle, $external_path, $expected_message = '') : void {
    $this->expectException(CacheableBadRequestHttpException::class);
    if (!empty($expected_message)) {
        $this->expectExceptionMessage($expected_message);
    }
    $resource_type = $this->resourceTypeRepository
        ->get($entity_type, $bundle);
    $this->sut
        ->resolveInternalEntityQueryPath($resource_type, $external_path);
}

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