Commit 80aa325d authored by catch's avatar catch

Issue #2935076 by amateescu: EntityResourceTestBase::getNormalizedPostEntity()...

Issue #2935076 by amateescu: EntityResourceTestBase::getNormalizedPostEntity() wrongly assumes that all entity types have auto-generated sequential IDs
parent 56247da6
......@@ -285,6 +285,23 @@ protected function getNormalizedPatchEntity() {
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.
*
......@@ -778,7 +795,7 @@ public function testPost() {
// 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->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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment