You are here

public function NodeMigrationTypePluginAlterTest::providerMigrationPluginAlter in Drupal 9

Same name and namespace in other branches
  1. 8 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 54

Class

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

Namespace

Drupal\Tests\migrate_drupal\Kernel

Code

public 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]['migrations'] = $migrations;
  $tests[0]['expected_data'] = $tests[0]['migrations'];

  // 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_data']['dependencies_altered_if_complete']['migration_dependencies'] = [
    'required' => [
      'd7_node_complete',
    ],
    'optional' => [
      'd7_node_complete',
    ],
  ];
  return $tests;
}