X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fmigrate_drupal%2Ftests%2Fsrc%2FKernel%2FMigrateFieldPluginManagerTest.php;fp=web%2Fcore%2Fmodules%2Fmigrate_drupal%2Ftests%2Fsrc%2FKernel%2FMigrateFieldPluginManagerTest.php;h=7c3c5a4a4c3c84edfe15322f0e170e22dbe3bd4e;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hp=0000000000000000000000000000000000000000;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad;p=yaffs-website diff --git a/web/core/modules/migrate_drupal/tests/src/Kernel/MigrateFieldPluginManagerTest.php b/web/core/modules/migrate_drupal/tests/src/Kernel/MigrateFieldPluginManagerTest.php new file mode 100644 index 000000000..7c3c5a4a4 --- /dev/null +++ b/web/core/modules/migrate_drupal/tests/src/Kernel/MigrateFieldPluginManagerTest.php @@ -0,0 +1,51 @@ +container->get('plugin.manager.migrate.field'); + + try { + // If this test passes, getPluginIdFromFieldType will raise a + // PluginNotFoundException and we'll never reach fail(). + $plugin_manager->getPluginIdFromFieldType('filefield', ['core' => 7]); + $this->fail('Expected Drupal\Component\Plugin\Exception\PluginNotFoundException.'); + } + catch (PluginNotFoundException $e) { + $this->assertIdentical($e->getMessage(), "Plugin ID 'filefield' was not found."); + } + + $this->assertIdentical('d6_file', $plugin_manager->getPluginIdFromFieldType('file', ['core' => 6])); + + // Test fallback when no core version is specified. + $this->assertIdentical('d6_no_core_version_specified', $plugin_manager->getPluginIdFromFieldType('d6_no_core_version_specified', ['core' => 6])); + + try { + // If this test passes, getPluginIdFromFieldType will raise a + // PluginNotFoundException and we'll never reach fail(). + $plugin_manager->getPluginIdFromFieldType('d6_no_core_version_specified', ['core' => 7]); + $this->fail('Expected Drupal\Component\Plugin\Exception\PluginNotFoundException.'); + } + catch (PluginNotFoundException $e) { + $this->assertIdentical($e->getMessage(), "Plugin ID 'd6_no_core_version_specified' was not found."); + } + } + +}