3 namespace Drupal\Tests\rest\Functional\EntityResource\MenuLinkContent;
5 use Drupal\menu_link_content\Entity\MenuLinkContent;
6 use Drupal\Tests\rest\Functional\BcTimestampNormalizerUnixTestTrait;
7 use Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase;
10 * ResourceTestBase for MenuLinkContent entity.
12 abstract class MenuLinkContentResourceTestBase extends EntityResourceTestBase {
14 use BcTimestampNormalizerUnixTestTrait;
19 public static $modules = ['menu_link_content'];
24 protected static $entityTypeId = 'menu_link_content';
29 protected static $patchProtectedFieldNames = [
34 * The MenuLinkContent entity.
36 * @var \Drupal\menu_link_content\MenuLinkContentInterface
43 protected function setUpAuthorization($method) {
49 $this->grantPermissionsToTestedRole(['administer menu']);
57 protected function createEntity() {
58 $menu_link = MenuLinkContent::create([
60 'title' => 'Llama Gabilondo',
61 'description' => 'Llama Gabilondo',
62 'link' => 'https://nl.wikipedia.org/wiki/Llama',
64 'menu_name' => 'main',
74 protected function getNormalizedPostEntity() {
78 'value' => 'Dramallama',
83 'uri' => 'http://www.urbandictionary.com/define.php?term=drama%20llama',
88 'value' => 'menu_link_content',
97 protected function getExpectedNormalizedEntity() {
101 'value' => $this->entity->uuid(),
111 'value' => 'Llama Gabilondo',
116 'uri' => 'https://nl.wikipedia.org/wiki/Llama',
138 'value' => 'menu_link_content',
143 'value' => 'Llama Gabilondo',
167 $this->formatExpectedTimestampItemValues($this->entity->getChangedTime()),
169 'default_langcode' => [
181 protected function getExpectedUnauthorizedAccessMessage($method) {
182 if ($this->config('rest.settings')->get('bc_entity_resource_permissions')) {
183 return parent::getExpectedUnauthorizedAccessMessage($method);
188 return "You are not authorized to delete this menu_link_content entity.";
190 return parent::getExpectedUnauthorizedAccessMessage($method);