X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Frest%2Ftests%2Fsrc%2FFunctional%2FRest%2FRestResourceConfigResourceTestBase.php;fp=web%2Fcore%2Fmodules%2Frest%2Ftests%2Fsrc%2FFunctional%2FRest%2FRestResourceConfigResourceTestBase.php;h=a0b0b2e428fd950903036d3ff8e795f6e519cd5c;hp=0000000000000000000000000000000000000000;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hpb=74df008bdbb3a11eeea356744f39b802369bda3c diff --git a/web/core/modules/rest/tests/src/Functional/Rest/RestResourceConfigResourceTestBase.php b/web/core/modules/rest/tests/src/Functional/Rest/RestResourceConfigResourceTestBase.php new file mode 100644 index 000000000..a0b0b2e42 --- /dev/null +++ b/web/core/modules/rest/tests/src/Functional/Rest/RestResourceConfigResourceTestBase.php @@ -0,0 +1,103 @@ +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', + ]; + } + +}