X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=web%2Fcore%2Fmodules%2Frest%2Ftests%2Fsrc%2FFunctional%2FEntityResource%2FNode%2FNodeResourceTestBase.php;fp=web%2Fcore%2Fmodules%2Frest%2Ftests%2Fsrc%2FFunctional%2FEntityResource%2FNode%2FNodeResourceTestBase.php;h=bf0ba7a59194545261c91b3dc329003af597a37c;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hp=492ff642e42eb4ae40d16ce221436ff30d961e30;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0;p=yaffs-website diff --git a/web/core/modules/rest/tests/src/Functional/EntityResource/Node/NodeResourceTestBase.php b/web/core/modules/rest/tests/src/Functional/EntityResource/Node/NodeResourceTestBase.php index 492ff642e..bf0ba7a59 100644 --- a/web/core/modules/rest/tests/src/Functional/EntityResource/Node/NodeResourceTestBase.php +++ b/web/core/modules/rest/tests/src/Functional/EntityResource/Node/NodeResourceTestBase.php @@ -235,20 +235,6 @@ abstract class NodeResourceTestBase extends EntityResourceTestBase { $response = $this->request('GET', $url, $this->getAuthenticationRequestOptions('GET')); $normalization = $this->serializer->decode((string) $response->getBody(), static::$format); - // @todo In https://www.drupal.org/node/2824851, we will be able to stop - // unsetting these fields from the normalization, because - // EntityResource::patch() will ignore any fields that are sent that - // match the current value (and obviously we're sending the current - // value). - $normalization = $this->removeFieldsFromNormalization($normalization, [ - 'revision_timestamp', - 'revision_uid', - 'created', - 'changed', - 'promote', - 'sticky', - ]); - // Change node's path alias. $normalization['path'][0]['alias'] .= 's-rule-the-world'; @@ -258,8 +244,11 @@ abstract class NodeResourceTestBase extends EntityResourceTestBase { $request_options = array_merge_recursive($request_options, $this->getAuthenticationRequestOptions('PATCH')); $request_options[RequestOptions::BODY] = $this->serializer->encode($normalization, static::$format); - // PATCH request: 403 when creating URL aliases unauthorized. + // PATCH request: 403 when creating URL aliases unauthorized. Before + // asserting the 403 response, assert that the stored path alias remains + // unchanged. $response = $this->request('PATCH', $url, $request_options); + $this->assertSame('/llama', $this->entityStorage->loadUnchanged($this->entity->id())->get('path')->alias); $this->assertResourceErrorResponse(403, "Access denied on updating field 'path'.", $response); // Grant permission to create URL aliases.