FeedCacheTagsTest.php

Same filename and directory in other branches
  1. 8.9.x core/modules/aggregator/tests/src/Functional/FeedCacheTagsTest.php

Namespace

Drupal\Tests\aggregator\Functional

File

core/modules/aggregator/tests/src/Functional/FeedCacheTagsTest.php

View source
<?php

namespace Drupal\Tests\aggregator\Functional;

use Drupal\aggregator\Entity\Feed;
use Drupal\Tests\system\Functional\Entity\EntityWithUriCacheTagsTestBase;
use Drupal\user\Entity\Role;
use Drupal\user\RoleInterface;

/**
 * Tests the Feed entity's cache tags.
 *
 * @group aggregator
 * @group legacy
 */
class FeedCacheTagsTest extends EntityWithUriCacheTagsTestBase {
    
    /**
     * {@inheritdoc}
     */
    protected static $modules = [
        'aggregator',
    ];
    
    /**
     * {@inheritdoc}
     */
    protected $defaultTheme = 'stark';
    
    /**
     * {@inheritdoc}
     */
    protected function setUp() : void {
        parent::setUp();
        // Give anonymous users permission to access feeds, so that we can verify
        // the cache tags of cached versions of feeds.
        $user_role = Role::load(RoleInterface::ANONYMOUS_ID);
        $user_role->grantPermission('access news feeds');
        $user_role->save();
    }
    
    /**
     * {@inheritdoc}
     */
    protected function createEntity() {
        // Create a "Llama" feed.
        $feed = Feed::create([
            'title' => 'Llama',
            'url' => 'https://www.drupal.org/',
            'refresh' => 900,
            'checked' => 1389919932,
            'description' => 'Drupal.org',
        ]);
        $feed->save();
        return $feed;
    }

}

Classes

Title Deprecated Summary
FeedCacheTagsTest Tests the Feed entity's cache tags.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.