You are here

public function FeedParserTest::testRedirectFeed in Zircon Profile 8

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

Tests that a redirected feed is tracked to its target.

File

core/modules/aggregator/src/Tests/FeedParserTest.php, line 90
Contains \Drupal\aggregator\Tests\FeedParserTest.

Class

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

Namespace

Drupal\aggregator\Tests

Code

public function testRedirectFeed() {
  $redirect_url = Url::fromRoute('aggregator_test.redirect')
    ->setAbsolute()
    ->toString();
  $feed = entity_create('aggregator_feed', array(
    'url' => $redirect_url,
    'title' => $this
      ->randomMachineName(),
  ));
  $feed
    ->save();
  $feed
    ->refreshItems();

  // Make sure that the feed URL was updated correctly.
  $this
    ->assertEqual($feed
    ->getUrl(), \Drupal::url('aggregator_test.feed', array(), array(
    'absolute' => TRUE,
  )));
}