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 / SearchPage / SearchPageResourceTestBase.php
index eca9ca83f7c200136eecd08c99d43a3c804620f6..d862bf2e91d88a77ee12cef8aa911022d150bc50 100644 (file)
 
 namespace Drupal\Tests\rest\Functional\EntityResource\SearchPage;
 
-use Drupal\search\Entity\SearchPage;
-use Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase;
+@trigger_error('The ' . __NAMESPACE__ . '\SearchPageResourceTestBase is deprecated in Drupal 8.6.x and will be removed before Drupal 9.0.0. Instead, use Drupal\Tests\search\Functional\Rest\SearchPageResourceTestBase. See https://www.drupal.org/node/2971931.', E_USER_DEPRECATED);
 
-abstract class SearchPageResourceTestBase extends EntityResourceTestBase {
-
-  /**
-   * {@inheritdoc}
-   */
-  public static $modules = ['node', 'search'];
-
-  /**
-   * {@inheritdoc}
-   */
-  protected static $entityTypeId = 'search_page';
-
-  /**
-   * @var \Drupal\search\SearchPageInterface
-   */
-  protected $entity;
-
-  /**
-   * {@inheritdoc}
-   */
-  protected function setUpAuthorization($method) {
-    switch ($method) {
-      case 'GET':
-        $this->grantPermissionsToTestedRole(['access content']);
-        break;
-
-      case 'POST':
-      case 'PATCH':
-      case 'DELETE':
-        $this->grantPermissionsToTestedRole(['administer search']);
-        break;
-    }
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  protected function createEntity() {
-    $search_page = SearchPage::create([
-      'id' => 'hinode_search',
-      'plugin' => 'node_search',
-      'label' => 'Search of magnetic activity of the Sun',
-      'path' => 'sun',
-    ]);
-    $search_page->save();
-    return $search_page;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  protected function getExpectedNormalizedEntity() {
-    return [
-      'configuration' => [
-        'rankings' => [],
-      ],
-      'dependencies' => [
-        'module' => ['node'],
-      ],
-      'id' => 'hinode_search',
-      'label' => 'Search of magnetic activity of the Sun',
-      'langcode' => 'en',
-      'path' => 'sun',
-      'plugin' => 'node_search',
-      'status' => TRUE,
-      'uuid' => $this->entity->uuid(),
-      'weight' => 0,
-    ];
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  protected function getNormalizedPostEntity() {
-    // @todo Update in https://www.drupal.org/node/2300677.
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  protected function getExpectedUnauthorizedAccessMessage($method) {
-    if ($this->config('rest.settings')->get('bc_entity_resource_permissions')) {
-      return parent::getExpectedUnauthorizedAccessMessage($method);
-    }
-
-    switch ($method) {
-      case 'GET':
-        return "The 'access content' permission is required.";
-
-      default:
-        return parent::getExpectedUnauthorizedAccessMessage($method);
-    }
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  protected function getExpectedUnauthorizedAccessCacheability() {
-    // @see \Drupal\search\SearchPageAccessControlHandler::checkAccess()
-    return parent::getExpectedUnauthorizedAccessCacheability()
-      ->addCacheTags(['config:search.page.hinode_search']);
-  }
+use Drupal\Tests\search\Functional\Rest\SearchPageResourceTestBase as SearchPageResourceTestBaseReal;
 
+/**
+ * @deprecated in Drupal 8.6.x. Will be removed before Drupal 9.0.0. Use
+ *   Drupal\Tests\search\Functional\Rest\SearchPageResourceTestBase instead.
+ *
+ * @see https://www.drupal.org/node/2971931
+ */
+abstract class SearchPageResourceTestBase extends SearchPageResourceTestBaseReal {
 }