function FilterTest::testInvalidFilterPathDueToElidedSoleProperty

Tests invalid filter path due to elided sole property.

@legacy-covers ::queryCondition

File

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

Class

FilterTest
Tests Drupal\jsonapi\Query\Filter.

Namespace

Drupal\Tests\jsonapi\Kernel\Query

Code

public function testInvalidFilterPathDueToElidedSoleProperty() : void {
  $this->expectException(CacheableBadRequestHttpException::class);
  $this->expectExceptionMessage('Invalid nested filtering. The property `value`, given in the path `promote.value`, does not exist. Filter by `promote`, not `promote.value` (the JSON:API module elides property names from single-property fields).');
  $resource_type = $this->resourceTypeRepository
    ->get('node', 'painting');
  Filter::createFromQueryParameter([
    'promote.value' => '',
  ], $resource_type, $this->fieldResolver);
}

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