You are here

public function GenericOpmlParserTest::test in Feeds 8.3

Basic tests for the generic OPML parser.

File

tests/src/Unit/Component/GenericOpmlParserTest.php, line 17

Class

GenericOpmlParserTest
@coversDefaultClass \Drupal\feeds\Component\GenericOpmlParser @group feeds

Namespace

Drupal\Tests\feeds\Unit\Component

Code

public function test() {
  $file = dirname(dirname(dirname(dirname(dirname(__FILE__))))) . '/tests/resources/opml-example.xml';
  $parser = new GenericOpmlParser(file_get_contents($file));
  $result = $parser
    ->parse();
  $this
    ->assertSame(count($result), 2);
  $this
    ->assertSame(count($result['head']), 11);
  $this
    ->assertSame(count($result['outlines']), 11);

  // Try with lowercase.
  $result = $parser
    ->parse(TRUE);
  $this
    ->assertSame(count($result), 2);
  $this
    ->assertSame(count($result['head']), 11);
  $this
    ->assertSame(count($result['outlines']), 11);
}