function MigrateFieldPluginManagerTest::testPluginSelection

Same name in other branches
  1. 9 core/modules/migrate_drupal/tests/src/Kernel/MigrateFieldPluginManagerTest.php \Drupal\Tests\migrate_drupal\Kernel\MigrateFieldPluginManagerTest::testPluginSelection()
  2. 8.9.x core/modules/migrate_drupal/tests/src/Kernel/MigrateFieldPluginManagerTest.php \Drupal\Tests\migrate_drupal\Kernel\MigrateFieldPluginManagerTest::testPluginSelection()
  3. 11.x core/modules/migrate_drupal/tests/src/Kernel/MigrateFieldPluginManagerTest.php \Drupal\Tests\migrate_drupal\Kernel\MigrateFieldPluginManagerTest::testPluginSelection()

Tests that the correct MigrateField plugins are used.

@covers ::getPluginIdFromFieldType

File

core/modules/migrate_drupal/tests/src/Kernel/MigrateFieldPluginManagerTest.php, line 54

Class

MigrateFieldPluginManagerTest
Tests the field plugin manager.

Namespace

Drupal\Tests\migrate_drupal\Kernel

Code

public function testPluginSelection() : void {
    $this->assertSame('link', $this->pluginManager
        ->getPluginIdFromFieldType('link', [
        'core' => 6,
    ]));
    $this->assertSame('link_field', $this->pluginManager
        ->getPluginIdFromFieldType('link_field', [
        'core' => 7,
    ]));
    $this->assertSame('image', $this->pluginManager
        ->getPluginIdFromFieldType('image', [
        'core' => 7,
    ]));
    $this->assertSame('file', $this->pluginManager
        ->getPluginIdFromFieldType('file', [
        'core' => 7,
    ]));
    $this->assertSame('d6_file', $this->pluginManager
        ->getPluginIdFromFieldType('file', [
        'core' => 6,
    ]));
    $this->assertSame('d6_text', $this->pluginManager
        ->getPluginIdFromFieldType('text', [
        'core' => 6,
    ]));
    $this->assertSame('d7_text', $this->pluginManager
        ->getPluginIdFromFieldType('text', [
        'core' => 7,
    ]));
    // Test that the deprecated d6 'date' plugin is not returned.
    $this->assertSame('datetime', $this->pluginManager
        ->getPluginIdFromFieldType('date', [
        'core' => 6,
    ]));
    // Test fallback when no core version is specified.
    $this->assertSame('d6_no_core_version_specified', $this->pluginManager
        ->getPluginIdFromFieldType('d6_no_core_version_specified', [
        'core' => 6,
    ]));
}

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