You are here

public function XmlParserTraitTest::testErrors in Feeds 8.3

Tests parsing a document with invalid XML.

File

tests/src/Unit/Component/XmlParserTraitTest.php, line 29

Class

XmlParserTraitTest
@coversDefaultClass \Drupal\feeds\Component\XmlParserTrait @group feeds

Namespace

Drupal\Tests\feeds\Unit\Component

Code

public function testErrors() {
  $trait = $this
    ->getMockForTrait('Drupal\\feeds\\Component\\XmlParserTrait');
  $doc = $this
    ->callProtectedMethod($trait, 'getDomDocument', [
    'asdfasdf',
  ]);
  $this
    ->assertSame('DOMDocument', get_class($doc));
  $errors = $this
    ->callProtectedMethod($trait, 'getXmlErrors');
  $this
    ->assertSame("Start tag expected, '<' not found", $errors[3][0]['message']);
}