3 namespace Drupal\Tests\taxonomy\Functional\Rest;
5 use Drupal\taxonomy\Entity\Vocabulary;
6 use Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase;
8 abstract class VocabularyResourceTestBase extends EntityResourceTestBase {
13 public static $modules = ['taxonomy'];
18 protected static $entityTypeId = 'taxonomy_vocabulary';
21 * @var \Drupal\taxonomy\VocabularyInterface
28 protected function setUpAuthorization($method) {
29 $this->grantPermissionsToTestedRole(['administer taxonomy']);
35 protected function createEntity() {
36 $vocabulary = Vocabulary::create([
48 protected function getExpectedNormalizedEntity() {
50 'uuid' => $this->entity->uuid(),
56 'description' => NULL,
65 protected function getNormalizedPostEntity() {
66 // @todo Update in https://www.drupal.org/node/2300677.
72 protected function getExpectedUnauthorizedAccessMessage($method) {
73 if ($this->config('rest.settings')->get('bc_entity_resource_permissions')) {
74 return parent::getExpectedUnauthorizedAccessMessage($method);
77 if ($method === 'GET') {
78 return "The following permissions are required: 'access taxonomy overview' OR 'administer taxonomy'.";
80 return parent::getExpectedUnauthorizedAccessMessage($method);