You are here

public function SimpleXmlTest::testReadNonXml in Migrate Plus 8.4

Same name and namespace in other branches
  1. 8.5 tests/src/Kernel/Plugin/migrate_plus/data_parser/SimpleXmlTest.php \Drupal\Tests\migrate_plus\Kernel\Plugin\migrate_plus\data_parser\SimpleXmlTest::testReadNonXml()

Test reading non XML.

Throws

\Drupal\Migrate\MigrateException

File

tests/src/Kernel/Plugin/migrate_plus/data_parser/SimpleXmlTest.php, line 170

Class

SimpleXmlTest
Test of the data_parser SimpleXml migrate_plus plugin.

Namespace

Drupal\Tests\migrate_plus\Kernel\Plugin\migrate_plus\data_parser

Code

public function testReadNonXml() {
  $url = $this->path . '/tests/data/simple_xml_non_xml.xml';
  $this->configuration['urls'][0] = $url;
  if (method_exists($this, 'setExpectedExceptionRegExp')) {
    $this
      ->setExpectedExceptionRegExp(MigrateException::class, '/^Fatal Error 46/');
  }
  else {
    $this
      ->expectException(MigrateException::class);
    $this
      ->expectExceptionMessageRegExp('/^Fatal Error 46/');
  }
  $parser = $this->pluginManager
    ->createInstance('simple_xml', $this->configuration);
  $parser
    ->next();
}