You are here

public function FeedParserTest::testRSS091Sample in Drupal 8

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

Tests a feed that uses the RSS 0.91 format.

File

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

Class

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

Namespace

Drupal\Tests\aggregator\Functional

Code

public function testRSS091Sample() {
  $feed = $this
    ->createFeed($this
    ->getRSS091Sample());
  $feed
    ->refreshItems();
  $this
    ->drupalGet('aggregator/sources/' . $feed
    ->id());
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertText('First example feed item title');
  $this
    ->assertLinkByHref('http://example.com/example-turns-one');
  $this
    ->assertText('First example feed item description.');
  $this
    ->assertRaw('<img src="http://example.com/images/druplicon.png"');

  // Several additional items that include elements over 255 characters.
  $this
    ->assertRaw("Second example feed item title.");
  $this
    ->assertText('Long link feed item title');
  $this
    ->assertText('Long link feed item description');
  $this
    ->assertLinkByHref('http://example.com/tomorrow/and/tomorrow/and/tomorrow/creeps/in/this/petty/pace/from/day/to/day/to/the/last/syllable/of/recorded/time/and/all/our/yesterdays/have/lighted/fools/the/way/to/dusty/death/out/out/brief/candle/life/is/but/a/walking/shadow/a/poor/player/that/struts/and/frets/his/hour/upon/the/stage/and/is/heard/no/more/it/is/a/tale/told/by/an/idiot/full/of/sound/and/fury/signifying/nothing');
  $this
    ->assertText('Long author feed item title');
  $this
    ->assertText('Long author feed item description');
  $this
    ->assertLinkByHref('http://example.com/long/author');
}