You are here

public function MigrationProvidersExistTest::testFieldProvidersExist in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/migrate/tests/src/Kernel/Plugin/MigrationProvidersExistTest.php \Drupal\Tests\migrate\Kernel\Plugin\MigrationProvidersExistTest::testFieldProvidersExist()
  2. 10 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 61

Class

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

Namespace

Drupal\Tests\migrate\Kernel\Plugin

Code

public function testFieldProvidersExist() {
  $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',
    ],
    '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',
    ],
  ];
  $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']);
  }
}