function MigrationProvidersExistTest::testProvidersExist
Tests that modules exist for all source plugins.
File
-
core/
modules/ migrate_drupal/ tests/ src/ Kernel/ Plugin/ MigrationProvidersExistTest.php, line 41
Class
- MigrationProvidersExistTest
- Tests that modules exist for all source and destination plugins.
Namespace
Drupal\Tests\migrate_drupal\Kernel\PluginCode
public function testProvidersExist() : void {
$this->enableAllModules();
/** @var \Drupal\migrate\Plugin\MigrateSourcePluginManager $plugin_manager */
$plugin_manager = $this->container
->get('plugin.manager.migrate.source');
foreach ($plugin_manager->getDefinitions() as $definition) {
// If the source plugin uses annotations, then the 'provider' key is the
// array of providers. If the source plugin uses attributes, then combine
// the singular string provider with the providers for the plugin
// dependencies.
if (is_array($definition['provider'])) {
$providers = $definition['provider'];
}
else {
$providers = $definition['dependencies']['provider'] ?? [];
$providers[] = $definition['provider'];
}
if (in_array('migrate_drupal', $providers, TRUE)) {
$id = $definition['id'];
$this->assertArrayHasKey('source_module', $definition, "No source_module property in '{$id}'");
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.