CommerceMigrationProvidersExistTest.php in Commerce Migrate 3.0.x
File
tests/src/Kernel/CommerceMigrationProvidersExistTest.php
View source
<?php
namespace Drupal\Tests\commerce_migrate\Kernel;
use Drupal\KernelTests\FileSystemModuleDiscoveryDataProviderTrait;
use Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalTestBase;
class CommerceMigrationProvidersExistTest extends MigrateDrupalTestBase {
use FileSystemModuleDiscoveryDataProviderTrait;
public static $modules = [
'commerce_store',
'commerce_migrate',
'commerce_migrate_commerce',
'commerce_migrate_ubercart',
];
protected $tags = [
'Ubercart',
'Commerce',
];
protected $invalidDestinations = [
'migrate',
'migrate_drupal',
'migrate_drupal_ui',
'commerce_migrate',
'commerce_migrate_commerce',
'commerce_migrate_ubercart',
];
public function testProvidersExist() {
self::$modules = array_keys($this
->coreModuleListDataProvider());
$plugin_manager = $this->container
->get('plugin.manager.migration');
$migrations = [];
foreach ($this->tags as $tag) {
$migrations = array_merge($migrations, $plugin_manager
->createInstancesByTag($tag));
}
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));
$this
->assertNotContains($destination_module, $this->invalidDestinations, sprintf('Invalid destination for %s.', $migration_id));
}
}
}