grantPermissionsToTestedRole(['access tour']); } /** * {@inheritdoc} */ protected function createEntity() { $tour = Tour::create([ 'id' => 'tour-llama', 'label' => 'Llama tour', 'langcode' => 'en', 'module' => 'tour', 'routes' => [ [ 'route_name' => '', ], ], 'tips' => [ 'tour-llama-1' => [ 'id' => 'tour-llama-1', 'plugin' => 'text', 'label' => 'Llama', 'body' => 'Who handle the awesomeness of llamas?', 'weight' => 100, 'attributes' => [ 'data-id' => 'tour-llama-1', ], ], ], ]); $tour->save(); return $tour; } /** * {@inheritdoc} */ protected function getExpectedNormalizedEntity() { return [ 'dependencies' => [], 'id' => 'tour-llama', 'label' => 'Llama tour', 'langcode' => 'en', 'module' => 'tour', 'routes' => [ [ 'route_name' => '', ], ], 'status' => TRUE, 'tips' => [ 'tour-llama-1' => [ 'id' => 'tour-llama-1', 'plugin' => 'text', 'label' => 'Llama', 'body' => 'Who handle the awesomeness of llamas?', 'weight' => 100, 'attributes' => [ 'data-id' => 'tour-llama-1', ], ], ], 'uuid' => $this->entity->uuid(), ]; } /** * {@inheritdoc} */ protected function getNormalizedPostEntity() { // @todo Update in https://www.drupal.org/node/2300677. } /** * {@inheritdoc} */ protected function getExpectedCacheContexts() { return [ 'user.permissions', ]; } /** * {@inheritdoc} */ protected function getExpectedUnauthorizedAccessMessage($method) { if ($this->config('rest.settings')->get('bc_entity_resource_permissions')) { return parent::getExpectedUnauthorizedAccessMessage($method); } return "The following permissions are required: 'access tour' OR 'administer site configuration'."; } }