class MigrationPluginConfigurationTest
Same name and namespace in other branches
- 11.x core/modules/migrate/tests/src/Kernel/Plugin/MigrationPluginConfigurationTest.php \Drupal\Tests\migrate\Kernel\Plugin\MigrationPluginConfigurationTest
- 10 core/modules/migrate/tests/src/Kernel/Plugin/MigrationPluginConfigurationTest.php \Drupal\Tests\migrate\Kernel\Plugin\MigrationPluginConfigurationTest
- 8.9.x core/modules/migrate/tests/src/Kernel/Plugin/MigrationPluginConfigurationTest.php \Drupal\Tests\migrate\Kernel\Plugin\MigrationPluginConfigurationTest
Tests the migration plugin manager.
@coversDefaultClass \Drupal\migrate\Plugin\MigratePluginManager
@group migrate
Hierarchy
- class \Drupal\KernelTests\KernelTestBase implements \Drupal\Core\DependencyInjection\ServiceProviderInterface uses \Drupal\KernelTests\AssertLegacyTrait, \Drupal\KernelTests\AssertContentTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\ExtensionListTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\migrate\Kernel\Plugin\MigrationPluginConfigurationTest extends \Drupal\KernelTests\KernelTestBase
Expanded class hierarchy of MigrationPluginConfigurationTest
File
-
core/
modules/ migrate/ tests/ src/ Kernel/ Plugin/ MigrationPluginConfigurationTest.php, line 13
Namespace
Drupal\Tests\migrate\Kernel\PluginView source
class MigrationPluginConfigurationTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'migrate',
'migrate_drupal',
// Test with a simple migration.
'ban',
'locale',
];
/**
* Tests merging configuration into a plugin through the plugin manager.
*
* @dataProvider mergeProvider
*/
public function testConfigurationMerge($id, $configuration, $expected) {
/** @var \Drupal\migrate\Plugin\MigrationInterface $migration */
$migration = $this->container
->get('plugin.manager.migration')
->createInstance($id, $configuration);
$source_configuration = $migration->getSourceConfiguration();
$this->assertEquals($expected, $source_configuration);
}
/**
* Provide configuration data for testing.
*/
public function mergeProvider() {
return [
// Tests adding new configuration to a migration.
[
// New configuration.
'd7_blocked_ips',
[
'source' => [
'constants' => [
'added_setting' => 'Ban them all!',
],
],
],
// Expected final source configuration.
[
'plugin' => 'd7_blocked_ips',
'constants' => [
'added_setting' => 'Ban them all!',
],
],
],
// Tests overriding pre-existing configuration in a migration.
[
// New configuration.
'd7_blocked_ips',
[
'source' => [
'plugin' => 'a_different_plugin',
],
],
// Expected final source configuration.
[
'plugin' => 'a_different_plugin',
],
],
// New configuration.
[
'locale_settings',
[
'source' => [
'plugin' => 'variable',
'variables' => [
'locale_cache_strings',
'locale_js_directory',
],
'source_module' => 'locale',
],
],
// Expected final source and process configuration.
[
'plugin' => 'variable',
'variables' => [
'locale_cache_strings',
'locale_js_directory',
],
'source_module' => 'locale',
],
],
];
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.