3 namespace Drupal\Tests\rest\Functional\EntityResource\Tour;
5 use Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase;
6 use Drupal\tour\Entity\Tour;
8 abstract class TourResourceTestBase extends EntityResourceTestBase {
13 public static $modules = ['tour'];
18 protected static $entityTypeId = 'tour';
21 * @var \Drupal\tour\TourInterface
28 protected function setUpAuthorization($method) {
29 $this->grantPermissionsToTestedRole(['access tour']);
35 protected function createEntity() {
36 $tour = Tour::create([
38 'label' => 'Llama tour',
43 'route_name' => '<front>',
48 'id' => 'tour-llama-1',
51 'body' => 'Who handle the awesomeness of llamas?',
54 'data-id' => 'tour-llama-1',
67 protected function getExpectedNormalizedEntity() {
71 'label' => 'Llama tour',
76 'route_name' => '<front>',
82 'id' => 'tour-llama-1',
85 'body' => 'Who handle the awesomeness of llamas?',
88 'data-id' => 'tour-llama-1',
92 'uuid' => $this->entity->uuid(),
99 protected function getNormalizedPostEntity() {
100 // @todo Update in https://www.drupal.org/node/2300677.
106 protected function getExpectedCacheContexts() {
115 protected function getExpectedUnauthorizedAccessMessage($method) {
116 if ($this->config('rest.settings')->get('bc_entity_resource_permissions')) {
117 return parent::getExpectedUnauthorizedAccessMessage($method);
120 return "The following permissions are required: 'access tour' OR 'administer site configuration'.";