8fce0fed15eccfcea2c6e3753888a6bfa5bd6e80
[yaffs-website] / web / core / modules / rest / tests / src / Functional / EntityResource / DateFormat / DateFormatResourceTestBase.php
1 <?php
2
3 namespace Drupal\Tests\rest\Functional\EntityResource\DateFormat;
4
5 use Drupal\Core\Datetime\Entity\DateFormat;
6 use Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase;
7
8 /**
9  * ResourceTestBase for DateFormat entity.
10  */
11 abstract class DateFormatResourceTestBase extends EntityResourceTestBase {
12
13   /**
14    * {@inheritdoc}
15    */
16   public static $modules = [];
17
18   /**
19    * {@inheritdoc}
20    */
21   protected static $entityTypeId = 'date_format';
22
23   /**
24    * The DateFormat entity.
25    *
26    * @var \Drupal\Core\Datetime\DateFormatInterface
27    */
28   protected $entity;
29
30   /**
31    * {@inheritdoc}
32    */
33   protected function setUpAuthorization($method) {
34     $this->grantPermissionsToTestedRole(['administer site configuration']);
35   }
36
37   /**
38    * {@inheritdoc}
39    */
40   protected function createEntity() {
41     // Create a date format.
42     $date_format = DateFormat::create([
43       'id' => 'llama',
44       'label' => 'Llama',
45       'pattern' => 'F d, Y',
46     ]);
47
48     $date_format->save();
49
50     return $date_format;
51   }
52
53   /**
54    * {@inheritdoc}
55    */
56   protected function getExpectedNormalizedEntity() {
57     return [
58       'dependencies' => [],
59       'id' => 'llama',
60       'label' => 'Llama',
61       'langcode' => 'en',
62       'locked' => FALSE,
63       'pattern' => 'F d, Y',
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 }