function MigrateExecutableTest::testMigrateExecutable

Same name in other branches
  1. 9 core/modules/migrate/tests/src/Kernel/MigrateExecutableTest.php \Drupal\Tests\migrate\Kernel\MigrateExecutableTest::testMigrateExecutable()
  2. 10 core/modules/migrate/tests/src/Kernel/MigrateExecutableTest.php \Drupal\Tests\migrate\Kernel\MigrateExecutableTest::testMigrateExecutable()
  3. 11.x core/modules/migrate/tests/src/Kernel/MigrateExecutableTest.php \Drupal\Tests\migrate\Kernel\MigrateExecutableTest::testMigrateExecutable()

Tests the MigrateExecutable class.

File

core/modules/migrate/tests/src/Kernel/MigrateExecutableTest.php, line 28

Class

MigrateExecutableTest
Tests the MigrateExecutable class.

Namespace

Drupal\Tests\migrate\Kernel

Code

public function testMigrateExecutable() {
    $data_rows = [
        [
            'key' => '1',
            'field1' => 'f1value1',
            'field2' => 'f2value1',
        ],
        [
            'key' => '2',
            'field1' => 'f1value2',
            'field2' => 'f2value2',
        ],
    ];
    $ids = [
        'key' => [
            'type' => 'integer',
        ],
    ];
    $definition = [
        'migration_tags' => [
            'Embedded data test',
        ],
        'source' => [
            'plugin' => 'embedded_data',
            'data_rows' => $data_rows,
            'ids' => $ids,
        ],
        'process' => [],
        'destination' => [
            'plugin' => 'entity:entity_test',
        ],
    ];
    $migration = \Drupal::service('plugin.manager.migration')->createStubMigration($definition);
    $executable = new TestMigrateExecutable($migration);
    $this->assertEquals(MigrationInterface::RESULT_COMPLETED, $executable->import());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.