protected function MigrateSourceTestBase::getPlugin in Drupal 8
Same name and namespace in other branches
- 9 core/modules/migrate/tests/src/Kernel/MigrateSourceTestBase.php \Drupal\Tests\migrate\Kernel\MigrateSourceTestBase::getPlugin()
- 10 core/modules/migrate/tests/src/Kernel/MigrateSourceTestBase.php \Drupal\Tests\migrate\Kernel\MigrateSourceTestBase::getPlugin()
Instantiates the source plugin under test.
Parameters
array $configuration: The source plugin configuration.
Return value
\Drupal\migrate\Plugin\MigrateSourceInterface|object The fully configured source plugin.
2 calls to MigrateSourceTestBase::getPlugin()
- MigrateSourceTestBase::testSource in core/
modules/ migrate/ tests/ src/ Kernel/ MigrateSourceTestBase.php - Tests the source plugin against a particular data set.
- MigrateSqlSourceTestBase::testSource in core/
modules/ migrate/ tests/ src/ Kernel/ MigrateSqlSourceTestBase.php - Tests the source plugin against a particular data set.
File
- core/
modules/ migrate/ tests/ src/ Kernel/ MigrateSourceTestBase.php, line 99
Class
- MigrateSourceTestBase
- Base class for tests of Migrate source plugins.
Namespace
Drupal\Tests\migrate\KernelCode
protected function getPlugin(array $configuration) {
// Only create the plugin once per test.
if ($this->plugin) {
return $this->plugin;
}
$class = ltrim($this
->getPluginClass(), '\\');
/** @var \Drupal\migrate\Plugin\MigratePluginManager $plugin_manager */
$plugin_manager = $this->container
->get('plugin.manager.migrate.source');
foreach ($plugin_manager
->getDefinitions() as $id => $definition) {
if (ltrim($definition['class'], '\\') == $class) {
$this->plugin = $plugin_manager
->createInstance($id, $configuration, $this->migration
->reveal());
$this->migration
->getSourcePlugin()
->willReturn($this->plugin);
return $this->plugin;
}
}
$this
->fail('No plugin found for class ' . $class);
}