public function CommerceMigrationProvidersExistTest::testProvidersExist in Commerce Migrate 3.0.x
Same name and namespace in other branches
- 8.2 tests/src/Kernel/CommerceMigrationProvidersExistTest.php \Drupal\Tests\commerce_migrate\Kernel\CommerceMigrationProvidersExistTest::testProvidersExist()
- 3.1.x tests/src/Kernel/CommerceMigrationProvidersExistTest.php \Drupal\Tests\commerce_migrate\Kernel\CommerceMigrationProvidersExistTest::testProvidersExist()
Tests that modules exist for all source and destination plugins.
File
- tests/
src/ Kernel/ CommerceMigrationProvidersExistTest.php, line 56
Class
- CommerceMigrationProvidersExistTest
- Tests that modules exist for all source and destination plugins.
Namespace
Drupal\Tests\commerce_migrate\KernelCode
public function testProvidersExist() {
// Enable all modules.
self::$modules = array_keys($this
->coreModuleListDataProvider());
/** @var \Drupal\migrate\Plugin\MigrationPluginManager $plugin_manager */
$plugin_manager = $this->container
->get('plugin.manager.migration');
// Get all the commerce_migrate migrations.
$migrations = [];
foreach ($this->tags as $tag) {
$migrations = array_merge($migrations, $plugin_manager
->createInstancesByTag($tag));
}
/** @var \Drupal\migrate\Plugin\Migration $migration */
foreach ($migrations as $migration) {
$source_module = $migration
->getSourcePlugin()
->getSourceModule();
$destination_module = $migration
->getDestinationPlugin()
->getDestinationModule();
$migration_id = $migration
->getPluginId();
$this
->assertNotNull($source_module, sprintf('Source module not found for %s.', $migration_id));
$this
->assertNotNull($destination_module, sprintf('Destination module not found for %s.', $migration_id));
// Destination module can't be a migrate module.
$this
->assertNotContains($destination_module, $this->invalidDestinations, sprintf('Invalid destination for %s.', $migration_id));
}
}