function FeedParserTest::testRSS091Sample

Same name in other branches
  1. 8.9.x 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 37

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->assertSession()
        ->pageTextContains('First example feed item title');
    $this->assertSession()
        ->linkByHrefExists('http://example.com/example-turns-one');
    $this->assertSession()
        ->pageTextContains('First example feed item description.');
    $this->assertSession()
        ->responseContains('<img src="http://example.com/images/druplicon.png"');
    // Several additional items that include elements over 255 characters.
    $this->assertSession()
        ->pageTextContains("Second example feed item title.");
    $this->assertSession()
        ->pageTextContains('Long link feed item title');
    $this->assertSession()
        ->pageTextContains('Long link feed item description');
    $this->assertSession()
        ->linkByHrefExists('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->assertSession()
        ->pageTextContains('Long author feed item title');
    $this->assertSession()
        ->pageTextContains('Long author feed item description');
    $this->assertSession()
        ->linkByHrefExists('http://example.com/long/author');
}

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