3 namespace Drupal\Tests\rest\Functional\EntityResource\Feed;
5 use Drupal\Tests\rest\Functional\EntityResource\EntityTest\EntityTestResourceTestBase;
6 use Drupal\aggregator\Entity\Feed;
8 abstract class FeedResourceTestBase extends EntityTestResourceTestBase {
13 public static $modules = ['aggregator'];
18 public static $entityTypeId = 'aggregator_feed';
23 protected function setUpAuthorization($method) {
26 $this->grantPermissionsToTestedRole(['access news feeds']);
31 $this->grantPermissionsToTestedRole(['administer news feeds']);
39 public function createEntity() {
40 $feed = Feed::create();
42 ->set('uuid', 'abcdefg')
44 ->setUrl('http://example.com/rss.xml')
45 ->setDescription('Feed Resource Test 1')
47 ->setLastCheckedTime(123456789)
48 ->setQueuedTime(123456789)
49 ->setWebsiteUrl('http://example.com')
50 ->setImage('http://example.com/feed_logo')
53 ->setLastModified(123456789)
62 protected function getExpectedNormalizedEntity() {
81 'value' => 'http://example.com/rss.xml'
106 'value' => 'http://example.com'
111 'value' => 'Feed Resource Test 1'
116 'value' => 'http://example.com/feed_logo'
140 protected function getNormalizedPostEntity() {
144 'value' => 'Feed Resource Post Test'
149 'value' => 'http://example.com/feed'
159 'value' => 'Feed Resource Post Test Description'
168 protected function getExpectedUnauthorizedAccessMessage($method) {
169 if ($this->config('rest.settings')->get('bc_entity_resource_permissions')) {
170 return parent::getExpectedUnauthorizedAccessMessage($method);
175 return "The 'access news feeds' permission is required.";
179 return "The 'administer news feeds' permission is required.";
181 return parent::getExpectedUnauthorizedAccessMessage($method);