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; ...@@ -14,7 +14,9 @@ use Drupal\migrate_drupal\Plugin\MigrateCckFieldInterface;
* core = {7}, * core = {7},
* type_map = { * type_map = {
* "addressfield" = "address" * "addressfield" = "address"
* } * },
* source_module = "addressfield",
* destination_module = "address"
* ) * )
* *
* @deprecated in 1.3, to be removed before 2.x. Use * @deprecated in 1.3, to be removed before 2.x. Use
......
...@@ -11,7 +11,9 @@ use Drupal\migrate_drupal\Plugin\migrate\field\FieldPluginBase; ...@@ -11,7 +11,9 @@ use Drupal\migrate_drupal\Plugin\migrate\field\FieldPluginBase;
* core = {7}, * core = {7},
* type_map = { * type_map = {
* "addressfield" = "address" * "addressfield" = "address"
* } * },
* source_module = "addressfield",
* destination_module = "address"
* ) * )
*/ */
class AddressField extends FieldPluginBase { class AddressField extends FieldPluginBase {
......
<?php <?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\field\AddressField;
use Drupal\address\Plugin\migrate\cckfield\AddressField as CckAddressField; use Drupal\address\Plugin\migrate\cckfield\AddressField as CckAddressField;
...@@ -15,6 +15,8 @@ use Drupal\migrate\Plugin\MigrationInterface; ...@@ -15,6 +15,8 @@ use Drupal\migrate\Plugin\MigrationInterface;
class AddressFieldTest extends KernelTestBase { class AddressFieldTest extends KernelTestBase {
/** /**
* Modules to enable.
*
* @var array * @var array
*/ */
public static $modules = [ public static $modules = [
...@@ -28,9 +30,10 @@ class AddressFieldTest extends KernelTestBase { ...@@ -28,9 +30,10 @@ class AddressFieldTest extends KernelTestBase {
*/ */
public function testPlugin() { public function testPlugin() {
$migration = $this->prophesize(MigrationInterface::class)->reveal(); $migration = $this->prophesize(MigrationInterface::class)->reveal();
$field_plugin = $this->container $field_plugin_manager = $this->container->get('plugin.manager.migrate.field');
->get('plugin.manager.migrate.field') $definition = $field_plugin_manager->getDefinition('addressfield');
->createInstance('addressfield', [], $migration); $this->assertNotEmpty($definition);
$field_plugin = $field_plugin_manager->createInstance('addressfield', [], $migration);
$this->assertInstanceOf(AddressField::class, $field_plugin); $this->assertInstanceOf(AddressField::class, $field_plugin);
} }
...@@ -39,10 +42,11 @@ class AddressFieldTest extends KernelTestBase { ...@@ -39,10 +42,11 @@ class AddressFieldTest extends KernelTestBase {
*/ */
public function testLegacyPlugin() { public function testLegacyPlugin() {
$migration = $this->prophesize(MigrationInterface::class)->reveal(); $migration = $this->prophesize(MigrationInterface::class)->reveal();
$field_plugin = $this->container $cck_plugin_manager = $this->container->get('plugin.manager.migrate.cckfield');
->get('plugin.manager.migrate.cckfield') $definition = $cck_plugin_manager->getDefinition('addressfield');
->createInstance('addressfield', [], $migration); $this->assertNotEmpty($definition);
$this->assertInstanceOf(CckAddressField::class, $field_plugin); $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