Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / rest / tests / src / Functional / EntityResource / MenuLinkContent / MenuLinkContentResourceTestBase.php
index 0b1f967387e1b5e920ee061b34de3a2e4c1cef62..327f5e5242cffe691aa6497315f8f4cddaa0e0d6 100644 (file)
 
 namespace Drupal\Tests\rest\Functional\EntityResource\MenuLinkContent;
 
-use Drupal\menu_link_content\Entity\MenuLinkContent;
-use Drupal\Tests\rest\Functional\BcTimestampNormalizerUnixTestTrait;
-use Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase;
+@trigger_error('The ' . __NAMESPACE__ . '\MenuLinkContentResourceTestBase is deprecated in Drupal 8.6.x and will be removed before Drupal 9.0.0. Instead, use Drupal\Tests\menu_link_content\Functional\Rest\MenuLinkContentResourceTestBase. See https://www.drupal.org/node/2971931.', E_USER_DEPRECATED);
+
+use Drupal\Tests\menu_link_content\Functional\Rest\MenuLinkContentResourceTestBase as MenuLinkContentResourceTestBaseReal;
 
 /**
- * ResourceTestBase for MenuLinkContent entity.
+ * @deprecated in Drupal 8.6.x. Will be removed before Drupal 9.0.0. Use
+ *   Drupal\Tests\menu_link_content\Functional\Rest\MenuLinkContentResourceTestBase instead.
+ *
+ * @see https://www.drupal.org/node/2971931
  */
-abstract class MenuLinkContentResourceTestBase extends EntityResourceTestBase {
-
-  use BcTimestampNormalizerUnixTestTrait;
-
-  /**
-   * {@inheritdoc}
-   */
-  public static $modules = ['menu_link_content'];
-
-  /**
-   * {@inheritdoc}
-   */
-  protected static $entityTypeId = 'menu_link_content';
-
-  /**
-   * {@inheritdoc}
-   */
-  protected static $patchProtectedFieldNames = [
-    'changed',
-  ];
-
-  /**
-   * The MenuLinkContent entity.
-   *
-   * @var \Drupal\menu_link_content\MenuLinkContentInterface
-   */
-  protected $entity;
-
-  /**
-   * {@inheritdoc}
-   */
-  protected function setUpAuthorization($method) {
-    switch ($method) {
-      case 'GET':
-      case 'POST':
-      case 'PATCH':
-      case 'DELETE':
-        $this->grantPermissionsToTestedRole(['administer menu']);
-        break;
-    }
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  protected function createEntity() {
-    $menu_link = MenuLinkContent::create([
-      'id' => 'llama',
-      'title' => 'Llama Gabilondo',
-      'description' => 'Llama Gabilondo',
-      'link' => 'https://nl.wikipedia.org/wiki/Llama',
-      'weight' => 0,
-      'menu_name' => 'main',
-    ]);
-    $menu_link->save();
-
-    return $menu_link;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  protected function getNormalizedPostEntity() {
-    return [
-      'title' => [
-        [
-          'value' => 'Dramallama',
-        ],
-      ],
-      'link' => [
-        [
-          'uri' => 'http://www.urbandictionary.com/define.php?term=drama%20llama',
-        ],
-      ],
-      'bundle' => [
-        [
-          'value' => 'menu_link_content',
-        ],
-      ],
-    ];
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  protected function getExpectedNormalizedEntity() {
-    return [
-      'uuid' => [
-        [
-          'value' => $this->entity->uuid(),
-        ],
-      ],
-      'id' => [
-        [
-          'value' => 1,
-        ],
-      ],
-      'title' => [
-        [
-          'value' => 'Llama Gabilondo',
-        ],
-      ],
-      'link' => [
-        [
-          'uri' => 'https://nl.wikipedia.org/wiki/Llama',
-          'title' => NULL,
-          'options' => [],
-        ],
-      ],
-      'weight' => [
-        [
-          'value' => 0,
-        ],
-      ],
-      'menu_name' => [
-        [
-          'value' => 'main',
-        ],
-      ],
-      'langcode' => [
-        [
-          'value' => 'en',
-        ],
-      ],
-      'bundle' => [
-        [
-          'value' => 'menu_link_content',
-        ],
-      ],
-      'description' => [
-        [
-          'value' => 'Llama Gabilondo',
-        ],
-      ],
-      'external' => [
-        [
-          'value' => FALSE,
-        ],
-      ],
-      'rediscover' => [
-        [
-          'value' => FALSE,
-        ],
-      ],
-      'expanded' => [
-        [
-          'value' => FALSE,
-        ],
-      ],
-      'enabled' => [
-        [
-          'value' => TRUE,
-        ],
-      ],
-      'changed' => [
-        $this->formatExpectedTimestampItemValues($this->entity->getChangedTime()),
-      ],
-      'default_langcode' => [
-        [
-          'value' => TRUE,
-        ],
-      ],
-      'parent' => [],
-    ];
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  protected function getExpectedUnauthorizedAccessMessage($method) {
-    if ($this->config('rest.settings')->get('bc_entity_resource_permissions')) {
-      return parent::getExpectedUnauthorizedAccessMessage($method);
-    }
-
-    switch ($method) {
-      case 'DELETE':
-        return "You are not authorized to delete this menu_link_content entity.";
-      default:
-        return parent::getExpectedUnauthorizedAccessMessage($method);
-    }
-  }
-
+abstract class MenuLinkContentResourceTestBase extends MenuLinkContentResourceTestBaseReal {
 }