You are here

public function OpmlParserTest::testParse in Feeds 8.3

Tests parsing an OPML file that succeeds.

@covers ::parse

File

tests/src/Unit/Feeds/Parser/OpmlParserTest.php, line 68

Class

OpmlParserTest
@coversDefaultClass \Drupal\feeds\Feeds\Parser\OpmlParser @group feeds

Namespace

Drupal\Tests\feeds\Unit\Feeds\Parser

Code

public function testParse() {
  $file = dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))) . '/tests/resources/opml-example.xml';
  $fetcher_result = new RawFetcherResult(file_get_contents($file), $this
    ->getMockFileSystem());
  $result = $this->parser
    ->parse($this->feed, $fetcher_result, $this->state);
  $this
    ->assertSame(count($result), 13);
  $this
    ->assertSame($result[0]
    ->get('title'), 'CNET News.com');
  $this
    ->assertSame($result[3]
    ->get('xmlurl'), 'http://rss.news.yahoo.com/rss/tech');
  $this
    ->assertSame($result[7]
    ->get('htmlurl'), 'http://www.fool.com');
}