Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / modules / rest / tests / src / Functional / EntityResource / EntityTestBundle / EntityTestBundleResourceTestBase.php
1 <?php
2
3 namespace Drupal\Tests\rest\Functional\EntityResource\EntityTestBundle;
4
5 use Drupal\entity_test\Entity\EntityTestBundle;
6 use Drupal\Tests\rest\Functional\BcTimestampNormalizerUnixTestTrait;
7 use Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase;
8
9 abstract class EntityTestBundleResourceTestBase extends EntityResourceTestBase {
10
11   use BcTimestampNormalizerUnixTestTrait;
12
13   /**
14    * {@inheritdoc}
15    */
16   public static $modules = ['entity_test'];
17
18   /**
19    * {@inheritdoc}
20    */
21   protected static $entityTypeId = 'entity_test_bundle';
22
23   /**
24    * {@inheritdoc}
25    */
26   protected static $patchProtectedFieldNames = [];
27
28   /**
29    * @var \Drupal\entity_test\Entity\EntityTestBundle
30    */
31   protected $entity;
32
33   /**
34    * {@inheritdoc}
35    */
36   protected function setUpAuthorization($method) {
37     $this->grantPermissionsToTestedRole(['administer entity_test_bundle content']);
38   }
39
40   /**
41    * {@inheritdoc}
42    */
43   protected function createEntity() {
44     $entity_test_bundle = EntityTestBundle::create([
45       'id' => 'camelids',
46       'label' => 'Camelids',
47       'description' => 'Camelids are large, strictly herbivorous animals with slender necks and long legs.',
48     ]);
49     $entity_test_bundle->save();
50
51     return $entity_test_bundle;
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       'uuid' => $this->entity->uuid(),
66     ];
67   }
68
69   /**
70    * {@inheritdoc}
71    */
72   protected function getNormalizedPostEntity() {
73     // @todo Update in https://www.drupal.org/node/2300677.
74   }
75
76 }