3 namespace Drupal\Tests\rest\Functional\EntityResource\MenuLinkContent;
5 use Drupal\menu_link_content\Entity\MenuLinkContent;
6 use Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase;
9 * ResourceTestBase for MenuLinkContent entity.
11 abstract class MenuLinkContentResourceTestBase extends EntityResourceTestBase {
16 public static $modules = ['menu_link_content'];
21 protected static $entityTypeId = 'menu_link_content';
26 protected static $patchProtectedFieldNames = [
31 * The MenuLinkContent entity.
33 * @var \Drupal\menu_link_content\MenuLinkContentInterface
40 protected function setUpAuthorization($method) {
46 $this->grantPermissionsToTestedRole(['administer menu']);
54 protected function createEntity() {
55 $menu_link = MenuLinkContent::create([
57 'title' => 'Llama Gabilondo',
58 'description' => 'Llama Gabilondo',
59 'link' => 'https://nl.wikipedia.org/wiki/Llama',
61 'menu_name' => 'main',
71 protected function getNormalizedPostEntity() {
75 'value' => 'Dramallama',
80 'uri' => 'http://www.urbandictionary.com/define.php?term=drama%20llama',
85 'value' => 'menu_link_content',
94 protected function getExpectedNormalizedEntity() {
98 'value' => $this->entity->uuid(),
108 'value' => 'Llama Gabilondo',
113 'uri' => 'https://nl.wikipedia.org/wiki/Llama',
135 'value' => 'menu_link_content',
140 'value' => 'Llama Gabilondo',
165 'value' => $this->entity->getChangedTime(),
168 'default_langcode' => [
180 protected function getExpectedUnauthorizedAccessMessage($method) {
181 if ($this->config('rest.settings')->get('bc_entity_resource_permissions')) {
182 return parent::getExpectedUnauthorizedAccessMessage($method);
187 return "You are not authorized to delete this menu_link_content entity.";
189 return parent::getExpectedUnauthorizedAccessMessage($method);