You are here

public function FilterTest::testInvalidFilterPathDueToNonexistentProperty in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/jsonapi/tests/src/Kernel/Query/FilterTest.php \Drupal\Tests\jsonapi\Kernel\Query\FilterTest::testInvalidFilterPathDueToNonexistentProperty()

@covers ::queryCondition

File

core/modules/jsonapi/tests/src/Kernel/Query/FilterTest.php, line 124

Class

FilterTest
@coversDefaultClass \Drupal\jsonapi\Query\Filter @group jsonapi @group jsonapi_query

Namespace

Drupal\Tests\jsonapi\Kernel\Query

Code

public function testInvalidFilterPathDueToNonexistentProperty() {
  $this
    ->expectException(CacheableBadRequestHttpException::class);
  $this
    ->expectExceptionMessage('Invalid nested filtering. The property `foobar`, given in the path `colors.foobar`, does not exist. Must be one of the following property names: `value`, `format`, `processed`.');
  $resource_type = $this->resourceTypeRepository
    ->get('node', 'painting');
  Filter::createFromQueryParameter([
    'colors.foobar' => '',
  ], $resource_type, $this->fieldResolver);
}