Commit 5908f05a authored by heddn's avatar heddn Committed by bojanz

Issue #2920118 by heddn, quietone: Update cck and field migration plugin

parent 9dc2137d
......@@ -14,7 +14,9 @@ use Drupal\migrate_drupal\Plugin\MigrateCckFieldInterface;
* core = {7},
* type_map = {
* "addressfield" = "address"
* }
* },
* source_module = "addressfield",
* destination_module = "address"
* )
*
* @deprecated in 1.3, to be removed before 2.x. Use
......
......@@ -11,7 +11,9 @@ use Drupal\migrate_drupal\Plugin\migrate\field\FieldPluginBase;
* core = {7},
* type_map = {
* "addressfield" = "address"
* }
* },
* source_module = "addressfield",
* destination_module = "address"
* )
*/
class AddressField extends FieldPluginBase {
......
<?php
namespace Drupal\Tests\address\Kernel;
namespace Drupal\Tests\address\Kernel\Plugin\migrate\field;
use Drupal\address\Plugin\migrate\field\AddressField;
use Drupal\address\Plugin\migrate\cckfield\AddressField as CckAddressField;
......@@ -15,6 +15,8 @@ use Drupal\migrate\Plugin\MigrationInterface;
class AddressFieldTest extends KernelTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = [
......@@ -28,9 +30,10 @@ class AddressFieldTest extends KernelTestBase {
*/
public function testPlugin() {
$migration = $this->prophesize(MigrationInterface::class)->reveal();
$field_plugin = $this->container
->get('plugin.manager.migrate.field')
->createInstance('addressfield', [], $migration);
$field_plugin_manager = $this->container->get('plugin.manager.migrate.field');
$definition = $field_plugin_manager->getDefinition('addressfield');
$this->assertNotEmpty($definition);
$field_plugin = $field_plugin_manager->createInstance('addressfield', [], $migration);
$this->assertInstanceOf(AddressField::class, $field_plugin);
}
......@@ -39,10 +42,11 @@ class AddressFieldTest extends KernelTestBase {
*/
public function testLegacyPlugin() {
$migration = $this->prophesize(MigrationInterface::class)->reveal();
$field_plugin = $this->container
->get('plugin.manager.migrate.cckfield')
->createInstance('addressfield', [], $migration);
$this->assertInstanceOf(CckAddressField::class, $field_plugin);
$cck_plugin_manager = $this->container->get('plugin.manager.migrate.cckfield');
$definition = $cck_plugin_manager->getDefinition('addressfield');
$this->assertNotEmpty($definition);
$cck_plugin = $cck_plugin_manager->createInstance('addressfield', [], $migration);
$this->assertInstanceOf(CckAddressField::class, $cck_plugin);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment