.../RestResourceConfigHalJsonAnonTest.php | 30 ++++++ .../RestResourceConfigHalJsonBasicAuthTest.php | 35 +++++++ .../RestResourceConfigHalJsonCookieTest.php | 30 ++++++ .../RestResourceConfigJsonAnonTest.php | 24 +++++ .../RestResourceConfigJsonBasicAuthTest.php | 34 +++++++ .../RestResourceConfigJsonCookieTest.php | 29 ++++++ .../RestResourceConfigResourceTestBase.php | 103 +++++++++++++++++++++ 7 files changed, 285 insertions(+) diff --git a/core/modules/hal/tests/src/Functional/EntityResource/RestResourceConfig/RestResourceConfigHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/EntityResource/RestResourceConfig/RestResourceConfigHalJsonAnonTest.php new file mode 100644 index 0000000..065ea2c --- /dev/null +++ b/core/modules/hal/tests/src/Functional/EntityResource/RestResourceConfig/RestResourceConfigHalJsonAnonTest.php @@ -0,0 +1,30 @@ +grantPermissionsToTestedRole(['administer rest resources']); + } + + /** + * {@inheritdoc} + */ + protected function createEntity() { + $rest_resource_config = RestResourceConfig::create([ + 'id' => 'llama', + 'plugin_id' => 'dblog', + 'granularity' => 'method', + 'configuration' => [ + 'GET' => [ + 'supported_formats' => [ + 'json', + ], + 'supported_auth' => [ + 'cookie', + ], + ], + ], + ]); + $rest_resource_config->save(); + + return $rest_resource_config; + } + + /** + * {@inheritdoc} + */ + protected function getExpectedNormalizedEntity() { + return [ + 'uuid' => $this->entity->uuid(), + 'langcode' => 'en', + 'status' => TRUE, + 'dependencies' => [ + 'module' => [ + 'dblog', + 'serialization', + 'user', + ], + ], + 'id' => 'llama', + 'plugin_id' => 'dblog', + 'granularity' => 'method', + 'configuration' => [ + 'GET' => [ + 'supported_formats' => [ + 'json', + ], + 'supported_auth' => [ + 'cookie', + ], + ], + ], + ]; + } + + /** + * {@inheritdoc} + */ + protected function getNormalizedPostEntity() { + // @todo Update in https://www.drupal.org/node/2300677. + } + + /** + * {@inheritdoc} + */ + protected function getExpectedCacheContexts() { + return [ + 'user.permissions', + ]; + } + +}