You are here

public function MigrateUpgradeDrushRunnerTest::getData in Migrate Upgrade 8.3

Returns test data for the test.

Return value

array The test data.

File

tests/src/Unit/MigrateUpgradeDrushRunnerTest.php, line 43

Class

MigrateUpgradeDrushRunnerTest
Tests for the MigrateUpgradeDrushRunner class.

Namespace

Drupal\Tests\migrate_upgrade\Unit

Code

public function getData() : array {
  return [
    'Single Migration Lookup' => [
      'source_data' => [
        'id' => 'my_migration',
        'process' => [
          'element' => [
            'plugin' => 'migration_lookup',
            'migration' => 'my_previous_migration',
            'source' => 'value',
          ],
        ],
        'migration_dependencies' => [
          'required' => [
            'my_previous_migration',
            'required_dependency',
          ],
          'optional' => [
            'optional_dependency',
          ],
        ],
      ],
      'expected_result' => [
        'id' => 'upgrade_my_migration',
        'process' => [
          'element' => [
            'plugin' => 'migration_lookup',
            'migration' => 'upgrade_my_previous_migration',
            'source' => 'value',
          ],
        ],
        'migration_dependencies' => [
          'required' => [
            'upgrade_my_previous_migration',
            'upgrade_required_dependency',
          ],
          'optional' => [
            'upgrade_optional_dependency',
          ],
        ],
      ],
    ],
    'Dual Migration Lookup' => [
      'source_data' => [
        'id' => 'my_migration',
        'process' => [
          'element' => [
            'plugin' => 'migration_lookup',
            'migration' => [
              'my_previous_migration_1',
              'my_previous_migration_2',
            ],
            'source_ids' => [
              'my_previous_migration_1' => [
                'source_1',
              ],
              'my_previous_migration_2' => [
                'source_2',
              ],
            ],
            'source' => 'value',
          ],
        ],
        'migration_dependencies' => [
          'required' => [
            'my_previous_migration_1',
            'required_dependency',
          ],
          'optional' => [
            'my_previous_migration_2',
            'optional_dependency',
          ],
        ],
      ],
      'expected_result' => [
        'id' => 'upgrade_my_migration',
        'process' => [
          'element' => [
            'plugin' => 'migration_lookup',
            'migration' => [
              'upgrade_my_previous_migration_1',
              'upgrade_my_previous_migration_2',
            ],
            'source_ids' => [
              'upgrade_my_previous_migration_1' => [
                'source_1',
              ],
              'upgrade_my_previous_migration_2' => [
                'source_2',
              ],
            ],
            'source' => 'value',
          ],
        ],
        'migration_dependencies' => [
          'required' => [
            'upgrade_my_previous_migration_1',
            'upgrade_required_dependency',
          ],
          'optional' => [
            'upgrade_my_previous_migration_2',
            'upgrade_optional_dependency',
          ],
        ],
      ],
    ],
    'Derivative Migration Lookup' => [
      'source_data' => [
        'id' => 'my_migration',
        'process' => [
          'element' => [
            'plugin' => 'migration_lookup',
            'migration' => 'derivable_migration',
            'source' => 'value',
          ],
        ],
        'migration_dependencies' => [
          'required' => [
            'derivable_migration',
            'required_dependency',
          ],
          'optional' => [
            'optional_dependency',
          ],
        ],
      ],
      'expected_result' => [
        'id' => 'upgrade_my_migration',
        'process' => [
          'element' => [
            'plugin' => 'migration_lookup',
            'migration' => [
              'upgrade_derivable_migration_derivitive_1',
              'upgrade_derivable_migration_derivitive_2',
            ],
            'source' => 'value',
          ],
        ],
        'migration_dependencies' => [
          'required' => [
            'upgrade_derivable_migration_derivitive_1',
            'upgrade_derivable_migration_derivitive_2',
            'upgrade_required_dependency',
          ],
          'optional' => [
            'upgrade_optional_dependency',
          ],
        ],
      ],
    ],
  ];
}