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 / Feed / FeedResourceTestBase.php
index a89bde1b69e0cd22e4f97732b580a5b6b568bdcd..2805b390f231646f6562003585469e5bd86331f4 100644 (file)
 
 namespace Drupal\Tests\rest\Functional\EntityResource\Feed;
 
-use Drupal\Tests\rest\Functional\BcTimestampNormalizerUnixTestTrait;
-use Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase;
-use Drupal\aggregator\Entity\Feed;
+@trigger_error('The ' . __NAMESPACE__ . '\FeedResourceTestBase is deprecated in Drupal 8.6.x and will be removed before Drupal 9.0.0. Instead, use Drupal\Tests\aggregator\Functional\Rest\FeedResourceTestBase. See https://www.drupal.org/node/2971931.', E_USER_DEPRECATED);
 
-abstract class FeedResourceTestBase extends EntityResourceTestBase {
-
-  use BcTimestampNormalizerUnixTestTrait;
-
-  /**
-   * {@inheritdoc}
-   */
-  public static $modules = ['aggregator'];
-
-  /**
-   * {@inheritdoc}
-   */
-  public static $entityTypeId = 'aggregator_feed';
-
-  /**
-   * {@inheritdoc}
-   */
-  protected static $patchProtectedFieldNames = [];
-
-  /**
-   * {@inheritdoc}
-   */
-  protected static $uniqueFieldNames = ['url'];
-
-  /**
-   * {@inheritdoc}
-   */
-  protected function setUpAuthorization($method) {
-    switch ($method) {
-      case 'GET':
-        $this->grantPermissionsToTestedRole(['access news feeds']);
-        break;
-      case 'POST':
-      case 'PATCH':
-      case 'DELETE':
-        $this->grantPermissionsToTestedRole(['administer news feeds']);
-        break;
-    }
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function createEntity() {
-    $feed = Feed::create();
-    $feed->set('fid', 1)
-      ->set('uuid', 'abcdefg')
-      ->setTitle('Feed')
-      ->setUrl('http://example.com/rss.xml')
-      ->setDescription('Feed Resource Test 1')
-      ->setRefreshRate(900)
-      ->setLastCheckedTime(123456789)
-      ->setQueuedTime(123456789)
-      ->setWebsiteUrl('http://example.com')
-      ->setImage('http://example.com/feed_logo')
-      ->setHash('abcdefg')
-      ->setEtag('hijklmn')
-      ->setLastModified(123456789)
-      ->save();
-
-    return $feed;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  protected function getExpectedNormalizedEntity() {
-    return [
-      'uuid' => [
-        [
-          'value' => 'abcdefg'
-        ]
-      ],
-      'fid' => [
-        [
-          'value' => 1
-        ]
-      ],
-      'langcode' => [
-        [
-          'value' => 'en'
-        ]
-      ],
-      'url' => [
-        [
-          'value' => 'http://example.com/rss.xml'
-        ]
-      ],
-      'title' => [
-        [
-          'value' => 'Feed'
-        ]
-      ],
-      'refresh' => [
-        [
-          'value' => 900
-        ]
-      ],
-      'checked' => [
-        $this->formatExpectedTimestampItemValues(123456789),
-      ],
-      'queued' => [
-        $this->formatExpectedTimestampItemValues(123456789),
-      ],
-      'link' => [
-        [
-          'value' => 'http://example.com'
-        ]
-      ],
-      'description' => [
-        [
-          'value' => 'Feed Resource Test 1'
-        ]
-      ],
-      'image' => [
-        [
-          'value' => 'http://example.com/feed_logo'
-        ]
-      ],
-      'hash' => [
-        [
-          'value' => 'abcdefg'
-        ]
-      ],
-      'etag' => [
-        [
-          'value' => 'hijklmn'
-        ]
-      ],
-      'modified' => [
-        $this->formatExpectedTimestampItemValues(123456789),
-      ],
-    ];
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  protected function getNormalizedPostEntity() {
-    return [
-      'title' => [
-        [
-          'value' => 'Feed Resource Post Test'
-        ]
-      ],
-      'url' => [
-        [
-          'value' => 'http://example.com/feed'
-        ]
-      ],
-      'refresh' => [
-        [
-          'value' => 900
-        ]
-      ],
-      'description' => [
-        [
-          'value' => 'Feed Resource Post Test Description'
-        ]
-      ],
-    ];
-  }
-
-  /**
-   * {@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 news feeds' permission is required.";
-      case 'POST':
-      case 'PATCH':
-      case 'DELETE':
-        return "The 'administer news feeds' permission is required.";
-      default:
-        return parent::getExpectedUnauthorizedAccessMessage($method);
-    }
-  }
+use Drupal\Tests\aggregator\Functional\Rest\FeedResourceTestBase as FeedResourceTestBaseReal;
 
+/**
+ * @deprecated in Drupal 8.6.x. Will be removed before Drupal 9.0.0. Use
+ *   Drupal\Tests\aggregator\Functional\Rest\FeedResourceTestBase instead.
+ *
+ * @see https://www.drupal.org/node/2971931
+ */
+abstract class FeedResourceTestBase extends FeedResourceTestBaseReal {
 }