Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / rest / tests / src / Functional / EntityResource / EntityViewMode / EntityViewModeResourceTestBase.php
1 <?php
2
3 namespace Drupal\Tests\rest\Functional\EntityResource\EntityViewMode;
4
5 use Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase;
6 use Drupal\Core\Entity\Entity\EntityViewMode;
7
8 abstract class EntityViewModeResourceTestBase extends EntityResourceTestBase {
9
10   /**
11    * {@inheritdoc}
12    *
13    * @todo: Remove 'field_ui' when https://www.drupal.org/node/2867266.
14    */
15   public static $modules = ['user', 'field_ui'];
16
17   /**
18    * {@inheritdoc}
19    */
20   protected static $entityTypeId = 'entity_view_mode';
21
22   /**
23    * @var \Drupal\Core\Entity\EntityViewModeInterface
24    */
25   protected $entity;
26
27   /**
28    * {@inheritdoc}
29    */
30   protected function setUpAuthorization($method) {
31     $this->grantPermissionsToTestedRole(['administer display modes']);
32   }
33
34   /**
35    * {@inheritdoc}
36    */
37   protected function createEntity() {
38     $entity_view_mode = EntityViewMode::create([
39       'id' => 'user.test',
40       'label' => 'Test',
41       'targetEntityType' => 'user',
42     ]);
43     $entity_view_mode->save();
44     return $entity_view_mode;
45   }
46
47   /**
48    * {@inheritdoc}
49    */
50   protected function getExpectedNormalizedEntity() {
51     return [
52       'cache' => TRUE,
53       'dependencies' => [
54         'module' => [
55           'user',
56         ],
57       ],
58       'id' => 'user.test',
59       'label' => 'Test',
60       'langcode' => 'en',
61       'status' => TRUE,
62       'targetEntityType' => 'user',
63       'uuid' => $this->entity->uuid(),
64     ];
65   }
66
67   /**
68    * {@inheritdoc}
69    */
70   protected function getNormalizedPostEntity() {
71     // @todo Update in https://www.drupal.org/node/2300677.
72   }
73
74 }