function NodeMigrationTypePluginAlterTest::providerMigrationPluginAlter

Same name in other branches
  1. 9 core/modules/migrate_drupal/tests/src/Kernel/NodeMigrationTypePluginAlterTest.php \Drupal\Tests\migrate_drupal\Kernel\NodeMigrationTypePluginAlterTest::providerMigrationPluginAlter()
  2. 8.9.x core/modules/migrate_drupal/tests/src/Kernel/NodeMigrationTypePluginAlterTest.php \Drupal\Tests\migrate_drupal\Kernel\NodeMigrationTypePluginAlterTest::providerMigrationPluginAlter()
  3. 11.x core/modules/migrate_drupal/tests/src/Kernel/NodeMigrationTypePluginAlterTest.php \Drupal\Tests\migrate_drupal\Kernel\NodeMigrationTypePluginAlterTest::providerMigrationPluginAlter()

Data provider for testMigrationPluginAlter().

File

core/modules/migrate_drupal/tests/src/Kernel/NodeMigrationTypePluginAlterTest.php, line 56

Class

NodeMigrationTypePluginAlterTest
Tests the assignment of the node migration type in migrations_plugin_alter.

Namespace

Drupal\Tests\migrate_drupal\Kernel

Code

public static function providerMigrationPluginAlter() {
    $tests = [];
    $migrations = [
        // The 'system_site' migration is needed to get the legacy Drupal version.
'system_site' => [
            'id' => 'system_site',
            'source' => [
                'plugin' => 'variable',
                'variables' => [
                    'site_name',
                    'site_mail',
                ],
                'source_module' => 'system',
            ],
            'process' => [],
        ],
        'no_dependencies_not_altered' => [
            'id' => 'no_dependencies_not_altered',
            'no_dependencies' => 'test',
            'process' => [
                'nid' => 'nid',
            ],
        ],
        'dependencies_altered_if_complete' => [
            'id' => 'test',
            'migration_dependencies' => [
                'required' => [
                    'd7_node',
                ],
                'optional' => [
                    'd7_node_translation',
                ],
            ],
        ],
        'dependencies_not_altered' => [
            'id' => 'd7_node',
            'migration_dependencies' => [
                'required' => [
                    'd7_node',
                ],
                'optional' => [
                    'd7_node_translation',
                ],
            ],
        ],
    ];
    // Test migrations are not altered when classic node migrations is in use.
    $tests[0]['type'] = NodeMigrateType::NODE_MIGRATE_TYPE_CLASSIC;
    $tests[0]['migration_definitions'] = $migrations;
    $tests[0]['expected'] = $tests[0]['migration_definitions'];
    // Test migrations are altered when complete node migrations is in use.
    $tests[1] = $tests[0];
    $tests[1]['type'] = NodeMigrateType::NODE_MIGRATE_TYPE_COMPLETE;
    $tests[1]['expected']['dependencies_altered_if_complete']['migration_dependencies'] = [
        'required' => [
            'd7_node_complete',
        ],
        'optional' => [
            'd7_node_complete',
        ],
    ];
    return $tests;
}

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