Upgraded drupal core with security updates
[yaffs-website] / web / core / modules / rest / tests / src / Functional / EntityResource / RestResourceConfig / RestResourceConfigResourceTestBase.php
1 <?php
2
3 namespace Drupal\Tests\rest\Functional\EntityResource\RestResourceConfig;
4
5 use Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase;
6 use Drupal\rest\Entity\RestResourceConfig;
7
8 abstract class RestResourceConfigResourceTestBase extends EntityResourceTestBase {
9
10   /**
11    * {@inheritdoc}
12    */
13   public static $modules = ['dblog'];
14
15   /**
16    * {@inheritdoc}
17    */
18   protected static $entityTypeId = 'rest_resource_config';
19
20   /**
21    * @var \Drupal\rest\RestResourceConfigInterface
22    */
23   protected $entity;
24
25   /**
26    * {@inheritdoc}
27    */
28   protected function setUpAuthorization($method) {
29     $this->grantPermissionsToTestedRole(['administer rest resources']);
30   }
31
32   /**
33    * {@inheritdoc}
34    */
35   protected function createEntity() {
36     $rest_resource_config = RestResourceConfig::create([
37       'id' => 'llama',
38       'plugin_id' => 'dblog',
39       'granularity' => 'method',
40       'configuration' => [
41         'GET' => [
42           'supported_formats' => [
43             'json',
44           ],
45           'supported_auth' => [
46             'cookie',
47           ],
48         ],
49       ],
50     ]);
51     $rest_resource_config->save();
52
53     return $rest_resource_config;
54   }
55
56   /**
57    * {@inheritdoc}
58    */
59   protected function getExpectedNormalizedEntity() {
60     return [
61       'uuid' => $this->entity->uuid(),
62       'langcode' => 'en',
63       'status' => TRUE,
64       'dependencies' => [
65         'module' => [
66           'dblog',
67           'serialization',
68           'user',
69         ],
70       ],
71       'id' => 'llama',
72       'plugin_id' => 'dblog',
73       'granularity' => 'method',
74       'configuration' => [
75         'GET' => [
76           'supported_formats' => [
77             'json',
78           ],
79           'supported_auth' => [
80             'cookie',
81           ],
82         ],
83       ],
84     ];
85   }
86
87   /**
88    * {@inheritdoc}
89    */
90   protected function getNormalizedPostEntity() {
91     // @todo Update in https://www.drupal.org/node/2300677.
92   }
93
94   /**
95    * {@inheritdoc}
96    */
97   protected function getExpectedCacheContexts() {
98     return [
99       'user.permissions',
100     ];
101   }
102
103 }