function FeedParserTest::testRedirectFeed

Same name and namespace in other branches
  1. 9 core/modules/aggregator/tests/src/Functional/FeedParserTest.php \Drupal\Tests\aggregator\Functional\FeedParserTest::testRedirectFeed()

Tests that a redirected feed is tracked to its target.

File

core/modules/aggregator/tests/src/Functional/FeedParserTest.php, line 94

Class

FeedParserTest
Tests the built-in feed parser with valid feed samples.

Namespace

Drupal\Tests\aggregator\Functional

Code

public function testRedirectFeed() {
    $redirect_url = Url::fromRoute('aggregator_test.redirect')->setAbsolute()
        ->toString();
    $feed = Feed::create([
        'url' => $redirect_url,
        'title' => $this->randomMachineName(),
    ]);
    $feed->save();
    $feed->refreshItems();
    // Make sure that the feed URL was updated correctly.
    $this->assertEqual($feed->getUrl(), Url::fromRoute('aggregator_test.feed', [], [
        'absolute' => TRUE,
    ])->toString());
}

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