You are here

public function SyndicationParserTest::testParse in Feeds 8.3

Tests parsing a RSS feed that succeeds.

@covers ::parse

File

tests/src/Unit/Feeds/Parser/SyndicationParserTest.php, line 104

Class

SyndicationParserTest
@coversDefaultClass \Drupal\feeds\Feeds\Parser\SyndicationParser @group feeds

Namespace

Drupal\Tests\feeds\Unit\Feeds\Parser

Code

public function testParse() {
  $file = $this
    ->resourcesPath() . '/rss/googlenewstz.rss2';
  $fetcher_result = new RawFetcherResult(file_get_contents($file), $this
    ->getMockFileSystem());
  $result = $this->parser
    ->parse($this->feed, $fetcher_result, $this->state);
  $this
    ->assertSame(count($result), 6);
  $this
    ->assertSame($result[0]
    ->get('title'), "First thoughts: Dems' Black Tuesday - msnbc.com");
  $this
    ->assertSame($result[0]
    ->get('author_name'), 'Person Name');
  $this
    ->assertSame($result[0]
    ->get('timestamp'), 1262805987);
  $this
    ->assertSame($result[0]
    ->get('updated'), 1262805987);
  $this
    ->assertSame($result[0]
    ->get('guid'), 'tag:news.google.com,2005:cluster=17593687403189');
  $this
    ->assertSame($result[3]
    ->get('title'), 'NEWSMAKER-New Japan finance minister a fiery battler - Reuters');
}