Pull merge.
[yaffs-website] / web / core / modules / user / tests / src / Functional / Rest / RoleResourceTestBase.php
1 <?php
2
3 namespace Drupal\Tests\user\Functional\Rest;
4
5 use Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase;
6 use Drupal\user\Entity\Role;
7
8 abstract class RoleResourceTestBase extends EntityResourceTestBase {
9
10   /**
11    * {@inheritdoc}
12    */
13   public static $modules = ['user'];
14
15   /**
16    * {@inheritdoc}
17    */
18   protected static $entityTypeId = 'user_role';
19
20   /**
21    * @var \Drupal\user\RoleInterface
22    */
23   protected $entity;
24
25   /**
26    * {@inheritdoc}
27    */
28   protected function setUpAuthorization($method) {
29     $this->grantPermissionsToTestedRole(['administer permissions']);
30   }
31
32   /**
33    * {@inheritdoc}
34    */
35   protected function createEntity() {
36     $role = Role::create([
37       'id' => 'llama',
38       'name' => $this->randomString(),
39     ]);
40     $role->save();
41
42     return $role;
43   }
44
45   /**
46    * {@inheritdoc}
47    */
48   protected function getExpectedNormalizedEntity() {
49     return [
50       'uuid' => $this->entity->uuid(),
51       'weight' => 2,
52       'langcode' => 'en',
53       'status' => TRUE,
54       'dependencies' => [],
55       'id' => 'llama',
56       'label' => NULL,
57       'is_admin' => NULL,
58       'permissions' => [],
59     ];
60   }
61
62   /**
63    * {@inheritdoc}
64    */
65   protected function getNormalizedPostEntity() {
66     // @todo Update in https://www.drupal.org/node/2300677.
67   }
68
69 }