.../src/Functional/EntityResource/EntityResourceTestBase.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php b/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php index 55825c8..fc712c9 100644 --- a/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php +++ b/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php @@ -1033,8 +1033,14 @@ public function testPatch() { // Change the rest_test_validation field to prove that then its validation // does run. In subsequent test assertions, it will not be modified, and // then should not trigger validation errors. - $modified_entity->get('rest_test_validation')->setValue('ALWAYS_FAIL'); - $valid_request_body = $this->getNormalizedPatchEntity() + $this->serializer->normalize($modified_entity, static::$format); + $override = [ + 'rest_test_validation' => [ + [ + 'value' => 'ALWAYS_FAIL', + ], + ], + ]; + $valid_request_body = $override + $this->getNormalizedPatchEntity() + $this->serializer->normalize($modified_entity, static::$format); $request_options[RequestOptions::BODY] = $this->serializer->serialize($valid_request_body, static::$format); $response = $this->request('PATCH', $url, $request_options); $this->assertResourceErrorResponse(422, "Unprocessable Entity: validation failed.\nrest_test_validation: REST test validation failed\n", $response);