function FieldDiscoveryTest::testGetCckPluginManager

Tests the fallback to deprecated CCK Plugin Manager.

@covers ::getCckPluginManager @group legacy @expectedDeprecation TextField is deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.x. Use \Drupal\text\Plugin\migrate\field\d6\TextField or \Drupal\text\Plugin\migrate\field\d7\TextField instead. @expectedDeprecation CckFieldPluginBase is deprecated in Drupal 8.3.x and will be be removed before Drupal 9.0.x. Use \Drupal\migrate_drupal\Plugin\migrate\field\FieldPluginBase instead. @expectedDeprecation MigrateCckFieldInterface is deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.x. Use \Drupal\migrate_drupal\Annotation\MigrateField instead.

File

core/modules/migrate_drupal/tests/src/Kernel/d7/FieldDiscoveryTest.php, line 330

Class

FieldDiscoveryTest
Test FieldDiscovery Service against Drupal 7.

Namespace

Drupal\Tests\migrate_drupal\Kernel\d7

Code

public function testGetCckPluginManager() {
    $definition = [
        'migration_tags' => [
            'Drupal 7',
        ],
    ];
    $migration = $this->migrationPluginManager
        ->createStubMigration($definition);
    $field_plugin_manager = $this->prophesize(MigrateFieldPluginManagerInterface::class);
    $field_plugin_manager->getPluginIdFromFieldType('text_long', [
        'core' => '7',
    ], $migration)
        ->willThrow(PluginNotFoundException::class);
    $field_discovery = new FieldDiscovery($field_plugin_manager->reveal(), $this->migrationPluginManager, $this->logger);
    $field_discovery->addBundleFieldProcesses($migration, 'comment', 'comment_node_page');
    $actual_process = $migration->getProcess();
    $expected_process = [
        'comment_body' => [
            0 => [
                'plugin' => 'sub_process',
                'source' => 'comment_body',
                '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',
                            'migration' => [
                                0 => 'd6_filter_format',
                                1 => 'd7_filter_format',
                            ],
                            'source' => 'format',
                        ],
                    ],
                ],
            ],
        ],
    ];
    $this->assertEquals($expected_process, $actual_process);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.