.../Rest/EntityTestMapFieldJsonAnonTest.php | 24 +++++++++ .../Rest/EntityTestMapFieldResourceTestBase.php} | 63 ++++++++++++---------- 2 files changed, 58 insertions(+), 29 deletions(-) diff --git a/core/modules/system/tests/modules/entity_test/tests/src/Functional/Rest/EntityTestMapFieldJsonAnonTest.php b/core/modules/system/tests/modules/entity_test/tests/src/Functional/Rest/EntityTestMapFieldJsonAnonTest.php new file mode 100644 index 0000000..0440680 --- /dev/null +++ b/core/modules/system/tests/modules/entity_test/tests/src/Functional/Rest/EntityTestMapFieldJsonAnonTest.php @@ -0,0 +1,24 @@ + 'value', 'key2' => 'no, val you', @@ -37,13 +46,24 @@ class EntityTestMapItemNormalizerTest extends EntityTestResourceTestBase { /** * {@inheritdoc} */ - protected static $mimeType = 'application/json'; + protected function setUpAuthorization($method) { + $this->grantPermissionsToTestedRole(['administer entity_test content']); + } /** * {@inheritdoc} */ - protected function setUpAuthorization($method) { - $this->grantPermissionsToTestedRole(['administer entity_test content']); + protected function createEntity() { + $entity = EntityTestMapField::create([ + 'name' => 'Llama', + 'type' => 'entity_test_map_field', + 'data' => [ + 0 => static::$mapValue, + ] + ]); + $entity->setOwnerId(0); + $entity->save(); + return $entity; } /** @@ -82,22 +102,6 @@ protected function getExpectedNormalizedEntity() { /** * {@inheritdoc} */ - protected function createEntity() { - $entity = EntityTestMapField::create([ - 'name' => 'Llama', - 'type' => 'entity_test_map_field', - 'data' => [ - 0 => static::$mapValue, - ] - ]); - $entity->setOwnerId(0); - $entity->save(); - return $entity; - } - - /** - * {@inheritdoc} - */ protected function getNormalizedPostEntity() { return [ 'name' => [ @@ -122,6 +126,7 @@ protected function getExpectedUnauthorizedAccessMessage($method) { return "The 'administer entity_test content' permission is required."; } + /** * {@inheritdoc} */