public function FieldDiscoveryTest::testAddFields in Drupal 9
Same name and namespace in other branches
- 8 core/modules/migrate_drupal/tests/src/Kernel/d6/FieldDiscoveryTest.php \Drupal\Tests\migrate_drupal\Kernel\d6\FieldDiscoveryTest::testAddFields()
Tests the addFields method.
@covers ::addAllFieldProcesses
File
- core/
modules/ migrate_drupal/ tests/ src/ Kernel/ d6/ FieldDiscoveryTest.php, line 220
Class
- FieldDiscoveryTest
- Tests FieldDiscovery service against Drupal 6.
Namespace
Drupal\Tests\migrate_drupal\Kernel\d6Code
public function testAddFields() {
$this
->migrateFields();
$field_discovery = $this->container
->get('migrate_drupal.field_discovery');
$migration_plugin_manager = $this->container
->get('plugin.manager.migration');
$definition = [
'migration_tags' => [
'Drupal 6',
],
];
$migration = $migration_plugin_manager
->createStubMigration($definition);
$field_discovery
->addBundleFieldProcesses($migration, 'node', 'test_planet');
$actual_process = $migration
->getProcess();
$expected_process = [
'field_multivalue' => [
0 => [
'plugin' => 'get',
'source' => 'field_multivalue',
],
],
'field_test_text_single_checkbox' => [
0 => [
'plugin' => 'sub_process',
'source' => 'field_test_text_single_checkbox',
'process' => [
'value' => 'value',
'format' => [
0 => [
'plugin' => 'static_map',
'bypass' => TRUE,
'source' => 'format',
'map' => [
0 => NULL,
],
],
1 => [
'plugin' => 'skip_on_empty',
'method' => 'process',
],
2 => [
'plugin' => 'migration_lookup',
'migration' => [
0 => 'd6_filter_format',
1 => 'd7_filter_format',
],
'source' => 'format',
],
],
],
],
],
];
$this
->assertEquals($expected_process, $actual_process);
}