You are here

public function SyndicationParserTest::testParseAtom in Feeds 8.3

Tests parsing an Atom feed.

@covers ::parse

File

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

Class

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

Namespace

Drupal\Tests\feeds\Unit\Feeds\Parser

Code

public function testParseAtom() {
  $file = $this
    ->resourcesPath() . '/atom/entries.atom';
  $fetcher_result = new RawFetcherResult(file_get_contents($file), $this
    ->getMockFileSystem());
  $result = $this->parser
    ->parse($this->feed, $fetcher_result, $this->state);
  $this
    ->assertSame(count($result), 3);
  $this
    ->assertSame($result[0]
    ->get('title'), 'Re-spin the patch');
  $this
    ->assertSame($result[0]
    ->get('content'), 'Re-spin the patch for feeds 7.x-2.0-beta2.');
  $this
    ->assertSame($result[0]
    ->get('description'), 'Re-spin the patch for feeds 7.x-2.0-beta2.');
  $this
    ->assertSame($result[0]
    ->get('author_name'), 'natew');
  $this
    ->assertSame($result[0]
    ->get('timestamp'), 1475082480);
  $this
    ->assertSame($result[0]
    ->get('updated'), 1477756140);
  $this
    ->assertSame($result[0]
    ->get('url'), 'node/1281496#comment-11669575');
  $this
    ->assertSame($result[0]
    ->get('guid'), 'comment-11669575');
}