Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / config / tests / config_test / tests / src / Functional / Rest / ConfigTestResourceTestBase.php
1 <?php
2
3 namespace Drupal\Tests\config_test\Functional\Rest;
4
5 use Drupal\config_test\Entity\ConfigTest;
6 use Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase;
7
8 abstract class ConfigTestResourceTestBase extends EntityResourceTestBase {
9
10   /**
11    * {@inheritdoc}
12    */
13   public static $modules = ['config_test', 'config_test_rest'];
14
15   /**
16    * {@inheritdoc}
17    */
18   protected static $entityTypeId = 'config_test';
19
20   /**
21    * @var \Drupal\config_test\ConfigTestInterface
22    */
23   protected $entity;
24
25   /**
26    * {@inheritdoc}
27    */
28   protected function setUpAuthorization($method) {
29     $this->grantPermissionsToTestedRole(['view config_test']);
30   }
31
32   /**
33    * {@inheritdoc}
34    */
35   protected function createEntity() {
36     $config_test = ConfigTest::create([
37       'id' => 'llama',
38       'label' => 'Llama',
39     ]);
40     $config_test->save();
41
42     return $config_test;
43   }
44
45   /**
46    * {@inheritdoc}
47    */
48   protected function getExpectedNormalizedEntity() {
49     $normalization = [
50       'uuid' => $this->entity->uuid(),
51       'id' => 'llama',
52       'weight' => 0,
53       'langcode' => 'en',
54       'status' => TRUE,
55       'dependencies' => [],
56       'label' => 'Llama',
57       'style' => NULL,
58       'size' => NULL,
59       'size_value' => NULL,
60       'protected_property' => NULL,
61     ];
62
63     return $normalization;
64   }
65
66   /**
67    * {@inheritdoc}
68    */
69   protected function getNormalizedPostEntity() {
70     // @todo Update in https://www.drupal.org/node/2300677.
71   }
72
73 }