function MigrationTest::testGetMigrationDependencies

Same name in this branch
  1. 10 core/modules/migrate/tests/src/Unit/MigrationTest.php \Drupal\Tests\migrate\Unit\MigrationTest::testGetMigrationDependencies()
Same name in other branches
  1. 9 core/modules/migrate/tests/src/Kernel/Plugin/MigrationTest.php \Drupal\Tests\migrate\Kernel\Plugin\MigrationTest::testGetMigrationDependencies()
  2. 8.9.x core/modules/migrate/tests/src/Kernel/Plugin/MigrationTest.php \Drupal\Tests\migrate\Kernel\Plugin\MigrationTest::testGetMigrationDependencies()
  3. 11.x core/modules/migrate/tests/src/Kernel/Plugin/MigrationTest.php \Drupal\Tests\migrate\Kernel\Plugin\MigrationTest::testGetMigrationDependencies()

Tests Migration::getMigrationDependencies()

@covers ::getMigrationDependencies

File

core/modules/migrate/tests/src/Kernel/Plugin/MigrationTest.php, line 86

Class

MigrationTest
Tests the migration plugin.

Namespace

Drupal\Tests\migrate\Kernel\Plugin

Code

public function testGetMigrationDependencies() : void {
    $plugin_manager = \Drupal::service('plugin.manager.migration');
    $plugin_definition = [
        'id' => 'foo',
        'deriver' => 'fooDeriver',
        'process' => [
            'f1' => 'bar',
            'f2' => [
                'plugin' => 'migration',
                'migration' => 'm1',
            ],
            'f3' => [
                'plugin' => 'sub_process',
                'process' => [
                    'target_id' => [
                        'plugin' => 'migration',
                        'migration' => 'm2',
                    ],
                ],
            ],
            'f4' => [
                'plugin' => 'migration_lookup',
                'migration' => 'm3',
            ],
            'f5' => [
                'plugin' => 'sub_process',
                'process' => [
                    'target_id' => [
                        'plugin' => 'migration_lookup',
                        'migration' => 'm4',
                    ],
                ],
            ],
            'f6' => [
                'plugin' => 'iterator',
                'process' => [
                    'target_id' => [
                        'plugin' => 'migration_lookup',
                        'migration' => 'm5',
                    ],
                ],
            ],
            'f7' => [
                'plugin' => 'migration_lookup',
                'migration' => 'foo',
            ],
        ],
    ];
    $migration = $plugin_manager->createStubMigration($plugin_definition);
    $this->assertSame([
        'required' => [],
        'optional' => [
            'm1',
            'm2',
            'm3',
            'm4',
            'm5',
        ],
    ], $migration->getMigrationDependencies(TRUE));
}

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