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