You are here

public function SitemapParserTest::testParse in Feeds 8.3

Tests parsing a sitemap XML file that succeeds.

@covers ::parse

File

tests/src/Unit/Feeds/Parser/SitemapParserTest.php, line 70

Class

SitemapParserTest
@coversDefaultClass \Drupal\feeds\Feeds\Parser\SitemapParser @group feeds

Namespace

Drupal\Tests\feeds\Unit\Feeds\Parser

Code

public function testParse() {
  $file = dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))) . '/tests/resources/sitemap-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), 5);
  $this
    ->assertSame($result[0]
    ->get('url'), 'http://www.example.com/');
  $this
    ->assertSame($result[3]
    ->get('priority'), '0.3');
}