public function EntityConditionNormalizerTest::denormalizeValidationProvider in JSON:API 8
Data provider for denormalizeProvider.
File
- tests/
src/ Kernel/ Normalizer/ EntityConditionNormalizerTest.php, line 89
Class
- EntityConditionNormalizerTest
- @coversDefaultClass \Drupal\jsonapi\Normalizer\EntityConditionNormalizer @group jsonapi @group jsonapi_normalizers @group legacy
Namespace
Drupal\Tests\jsonapi\Kernel\NormalizerCode
public function denormalizeValidationProvider() {
return [
[
[
'path' => 'some_field',
'value' => 'some_value',
],
NULL,
],
[
[
'path' => 'some_field',
'value' => 'some_value',
'operator' => '=',
],
NULL,
],
[
[
'path' => 'some_field',
'operator' => 'IS NULL',
],
NULL,
],
[
[
'path' => 'some_field',
'operator' => 'IS NOT NULL',
],
NULL,
],
[
[
'path' => 'some_field',
'operator' => 'IS',
'value' => 'some_value',
],
new BadRequestHttpException("The 'IS' operator is not allowed in a filter parameter."),
],
[
[
'path' => 'some_field',
'operator' => 'NOT_ALLOWED',
'value' => 'some_value',
],
new BadRequestHttpException("The 'NOT_ALLOWED' operator is not allowed in a filter parameter."),
],
[
[
'path' => 'some_field',
'operator' => 'IS NULL',
'value' => 'should_not_be_here',
],
new BadRequestHttpException("Filters using the 'IS NULL' operator should not provide a value."),
],
[
[
'path' => 'some_field',
'operator' => 'IS NOT NULL',
'value' => 'should_not_be_here',
],
new BadRequestHttpException("Filters using the 'IS NOT NULL' operator should not provide a value."),
],
[
[
'path' => 'path_only',
],
new BadRequestHttpException("Filter parameter is missing a '" . EntityConditionNormalizer::VALUE_KEY . "' key."),
],
[
[
'value' => 'value_only',
],
new BadRequestHttpException("Filter parameter is missing a '" . EntityConditionNormalizer::PATH_KEY . "' key."),
],
];
}