function MigrationProvidersExistTest::testFieldProvidersExist

Same name in other branches
  1. 9 core/modules/migrate/tests/src/Kernel/Plugin/MigrationProvidersExistTest.php \Drupal\Tests\migrate\Kernel\Plugin\MigrationProvidersExistTest::testFieldProvidersExist()
  2. 8.9.x core/modules/migrate/tests/src/Kernel/Plugin/MigrationProvidersExistTest.php \Drupal\Tests\migrate\Kernel\Plugin\MigrationProvidersExistTest::testFieldProvidersExist()
  3. 11.x core/modules/migrate/tests/src/Kernel/Plugin/MigrationProvidersExistTest.php \Drupal\Tests\migrate\Kernel\Plugin\MigrationProvidersExistTest::testFieldProvidersExist()

Tests that modules exist for all field plugins.

File

core/modules/migrate/tests/src/Kernel/Plugin/MigrationProvidersExistTest.php, line 64

Class

MigrationProvidersExistTest
Tests that modules exist for all source and destination plugins.

Namespace

Drupal\Tests\migrate\Kernel\Plugin

Code

public function testFieldProvidersExist() : void {
    $expected_mappings = [
        'userreference' => [
            'source_module' => 'userreference',
            'destination_module' => 'core',
        ],
        'nodereference' => [
            'source_module' => 'nodereference',
            'destination_module' => 'core',
        ],
        'optionwidgets' => [
            'source_module' => 'optionwidgets',
            'destination_module' => 'options',
        ],
        'list' => [
            'source_module' => 'list',
            'destination_module' => 'options',
        ],
        'options' => [
            'source_module' => 'options',
            'destination_module' => 'options',
        ],
        'filefield' => [
            'source_module' => 'filefield',
            'destination_module' => 'file',
        ],
        'imagefield' => [
            'source_module' => 'imagefield',
            'destination_module' => 'image',
        ],
        'file' => [
            'source_module' => 'file',
            'destination_module' => 'file',
        ],
        'image' => [
            'source_module' => 'image',
            'destination_module' => 'image',
        ],
        'phone' => [
            'source_module' => 'phone',
            'destination_module' => 'telephone',
        ],
        'telephone' => [
            'source_module' => 'telephone',
            'destination_module' => 'telephone',
        ],
        'link' => [
            'source_module' => 'link',
            'destination_module' => 'link',
        ],
        'link_field' => [
            'source_module' => 'link',
            'destination_module' => 'link',
        ],
        'd6_text' => [
            'source_module' => 'text',
            'destination_module' => 'text',
        ],
        'd7_text' => [
            'source_module' => 'text',
            'destination_module' => 'text',
        ],
        'taxonomy_term_reference' => [
            'source_module' => 'taxonomy',
            'destination_module' => 'core',
        ],
        'date' => [
            'source_module' => 'date',
            'destination_module' => 'datetime',
        ],
        'datetime' => [
            'source_module' => 'date',
            'destination_module' => 'datetime',
        ],
        'email' => [
            'source_module' => 'email',
            'destination_module' => 'core',
        ],
        'number_default' => [
            'source_module' => 'number',
            'destination_module' => 'core',
        ],
        'entityreference' => [
            'source_module' => 'entityreference',
            'destination_module' => 'core',
        ],
        'node_reference' => [
            'source_module' => 'node_reference',
            'destination_module' => 'core',
        ],
        'user_reference' => [
            'source_module' => 'user_reference',
            'destination_module' => 'core',
        ],
    ];
    $this->enableAllModules();
    $definitions = $this->container
        ->get('plugin.manager.migrate.field')
        ->getDefinitions();
    foreach ($definitions as $key => $definition) {
        $this->assertArrayHasKey($key, $expected_mappings);
        $this->assertEquals($expected_mappings[$key]['source_module'], $definition['source_module']);
        $this->assertEquals($expected_mappings[$key]['destination_module'], $definition['destination_module']);
    }
}

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