You are here

protected function SimpleXmlTest::setUp in Migrate Plus 8.5

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

Overrides KernelTestBase::setUp

File

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

Class

SimpleXmlTest
Test of the data_parser SimpleXml migrate_plus plugin.

Namespace

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

Code

protected function setUp() : void {
  parent::setUp();
  $this->path = $this->container
    ->get('module_handler')
    ->getModule('migrate_plus')
    ->getPath();
  $this->pluginManager = $this->container
    ->get('plugin.manager.migrate_plus.data_parser');
  $this->configuration = [
    'plugin' => 'url',
    'data_fetcher_plugin' => 'file',
    'data_parser_plugin' => 'simple_xml',
    'destination' => 'node',
    'urls' => [],
    'ids' => [
      'id' => [
        'type' => 'integer',
      ],
    ],
    'fields' => [
      [
        'name' => 'id',
        'label' => 'Id',
        'selector' => '@id',
      ],
      [
        'name' => 'values',
        'label' => 'Values',
        'selector' => 'values',
      ],
    ],
    'item_selector' => '/items/item',
  ];
  $this->expected = [
    [
      'Value 1',
      'Value 2',
    ],
    [
      'Value 1 (single)',
    ],
  ];
}