From e37745362c8ea231d2b44e4f265ecc5b594271c8 Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Fri, 9 Oct 2020 22:01:55 +0100 Subject: [PATCH] Issue #3173076 by anmolgoyal74, shetpooja04, sulfikar_s, Pooja Ganjage, longwave, alexpott: Unused variable $parseable_valid_request_body_2 in EntityResourceTestBase.php, rest module --- .../tests/src/Functional/ResourceTestBase.php | 2 -- .../EntityResource/EntityResourceTestBase.php | 19 ------------------- .../WorkspaceResourceTestBase.php | 10 ---------- 3 files changed, 31 deletions(-) diff --git a/core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php b/core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php index 33d230b7f44..c47a31cc76e 100644 --- a/core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php +++ b/core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php @@ -1883,7 +1883,6 @@ abstract class ResourceTestBase extends BrowserTestBase { // Try with all of the following request bodies. $unparseable_request_body = '!{>}<'; $parseable_valid_request_body = Json::encode($this->getPostDocument()); - /* $parseable_valid_request_body_2 = Json::encode($this->getNormalizedPostEntity()); */ $parseable_invalid_request_body_missing_type = Json::encode($this->removeResourceTypeFromDocument($this->getPostDocument())); if ($this->entity->getEntityType()->hasKey('label')) { $parseable_invalid_request_body = Json::encode($this->makeNormalizationInvalid($this->getPostDocument(), 'label')); @@ -2105,7 +2104,6 @@ abstract class ResourceTestBase extends BrowserTestBase { // Try with all of the following request bodies. $unparseable_request_body = '!{>}<'; $parseable_valid_request_body = Json::encode($this->getPatchDocument()); - /* $parseable_valid_request_body_2 = Json::encode($this->getNormalizedPatchEntity()); */ if ($this->entity->getEntityType()->hasKey('label')) { $parseable_invalid_request_body = Json::encode($this->makeNormalizationInvalid($this->getPatchDocument(), 'label')); } diff --git a/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php b/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php index 910c7c61018..c08eb82d7b7 100644 --- a/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php +++ b/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php @@ -298,23 +298,6 @@ abstract class EntityResourceTestBase extends ResourceTestBase { return $this->getNormalizedPostEntity(); } - /** - * Gets the second normalized POST entity. - * - * Entity types can have non-sequential IDs, and in that case the second - * entity created for POST testing needs to be able to specify a different ID. - * - * @see ::testPost - * @see ::getNormalizedPostEntity - * - * @return array - * An array structure as returned by ::getNormalizedPostEntity(). - */ - protected function getSecondNormalizedPostEntity() { - // Return the values of the "parent" method by default. - return $this->getNormalizedPostEntity(); - } - /** * Gets the normalized POST entity with random values for its unique fields. * @@ -718,7 +701,6 @@ abstract class EntityResourceTestBase extends ResourceTestBase { // Try with all of the following request bodies. $unparseable_request_body = '!{>}<'; $parseable_valid_request_body = $this->serializer->encode($this->getNormalizedPostEntity(), static::$format); - $parseable_valid_request_body_2 = $this->serializer->encode($this->getSecondNormalizedPostEntity(), static::$format); $parseable_invalid_request_body = $this->serializer->encode($this->makeNormalizationInvalid($this->getNormalizedPostEntity(), 'label'), static::$format); $parseable_invalid_request_body_2 = $this->serializer->encode($this->getNormalizedPostEntity() + ['uuid' => [$this->randomMachineName(129)]], static::$format); $parseable_invalid_request_body_3 = $this->serializer->encode($this->getNormalizedPostEntity() + ['field_rest_test' => [['value' => $this->randomString()]]], static::$format); @@ -897,7 +879,6 @@ abstract class EntityResourceTestBase extends ResourceTestBase { // Try with all of the following request bodies. $unparseable_request_body = '!{>}<'; $parseable_valid_request_body = $this->serializer->encode($this->getNormalizedPatchEntity(), static::$format); - $parseable_valid_request_body_2 = $this->serializer->encode($this->getNormalizedPatchEntity(), static::$format); $parseable_invalid_request_body = $this->serializer->encode($this->makeNormalizationInvalid($this->getNormalizedPatchEntity(), 'label'), static::$format); $parseable_invalid_request_body_2 = $this->serializer->encode($this->getNormalizedPatchEntity() + ['field_rest_test' => [['value' => $this->randomString()]]], static::$format); // The 'field_rest_test' field does not allow 'view' access, so does not end diff --git a/core/modules/workspaces/tests/src/Functional/EntityResource/WorkspaceResourceTestBase.php b/core/modules/workspaces/tests/src/Functional/EntityResource/WorkspaceResourceTestBase.php index 1c35e371dc6..51b51765129 100644 --- a/core/modules/workspaces/tests/src/Functional/EntityResource/WorkspaceResourceTestBase.php +++ b/core/modules/workspaces/tests/src/Functional/EntityResource/WorkspaceResourceTestBase.php @@ -159,16 +159,6 @@ abstract class WorkspaceResourceTestBase extends EntityResourceTestBase { ]; } - /** - * {@inheritdoc} - */ - protected function getSecondNormalizedPostEntity() { - $normalized_post_entity = $this->getNormalizedPostEntity(); - $normalized_post_entity['id'][0]['value'] = static::$secondCreatedEntityId; - - return $normalized_post_entity; - } - /** * {@inheritdoc} */