Upgraded drupal core with security updates
[yaffs-website] / web / core / modules / rest / tests / src / Functional / EntityResource / CommentType / CommentTypeResourceTestBase.php
1 <?php
2
3 namespace Drupal\Tests\rest\Functional\EntityResource\CommentType;
4
5 use Drupal\comment\Entity\CommentType;
6 use Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase;
7
8 /**
9  * ResourceTestBase for CommentType entity.
10  */
11 abstract class CommentTypeResourceTestBase extends EntityResourceTestBase {
12
13   /**
14    * {@inheritdoc}
15    */
16   public static $modules = ['node', 'comment'];
17
18   /**
19    * {@inheritdoc}
20    */
21   protected static $entityTypeId = 'comment_type';
22
23   /**
24    * The CommentType entity.
25    *
26    * @var \Drupal\comment\CommentTypeInterface
27    */
28   protected $entity;
29
30   /**
31    * {@inheritdoc}
32    */
33   protected function setUpAuthorization($method) {
34     $this->grantPermissionsToTestedRole(['administer comment types']);
35   }
36
37   /**
38    * {@inheritdoc}
39    */
40   protected function createEntity() {
41     // Create a "Camelids" comment type.
42     $camelids = CommentType::create([
43       'id' => 'camelids',
44       'label' => 'Camelids',
45       'description' => 'Camelids are large, strictly herbivorous animals with slender necks and long legs.',
46       'target_entity_type_id' => 'node',
47     ]);
48
49     $camelids->save();
50
51     return $camelids;
52   }
53
54   /**
55    * {@inheritdoc}
56    */
57   protected function getExpectedNormalizedEntity() {
58     return [
59       'dependencies' => [],
60       'description' => 'Camelids are large, strictly herbivorous animals with slender necks and long legs.',
61       'id' => 'camelids',
62       'label' => 'Camelids',
63       'langcode' => 'en',
64       'status' => TRUE,
65       'target_entity_type_id' => 'node',
66       'uuid' => $this->entity->uuid(),
67     ];
68   }
69
70   /**
71    * {@inheritdoc}
72    */
73   protected function getNormalizedPostEntity() {
74     // @todo Update in https://www.drupal.org/node/2300677.
75   }
76
77 }