Issue #3004929 by mikelutz, heddn: Fix 'The Drupal\migrate\Plugin\migrate\process\Migration is deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. Instead, use Drupal\migrate\Plugin\migrate\process\MigrationLookup'

(cherry picked from commit efc4dd9796)
merge-requests/64/head
Alex Pott 2019-11-02 06:52:57 +01:00
parent ee89209bee
commit e8b6250313
No known key found for this signature in database
GPG Key ID: 31905460D4A69276
22 changed files with 634 additions and 91 deletions

View File

@ -4,6 +4,7 @@ namespace Drupal\block\Plugin\migrate\process;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\migrate\MigrateLookupInterface;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\Plugin\MigrateProcessInterface;
@ -19,13 +20,27 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
class BlockPluginId extends ProcessPluginBase implements ContainerFactoryPluginInterface {
/**
* The migration process plugin, configured for lookups in d6_custom_block
* and d7_custom_block.
* The migration process plugin.
*
* The plugin is configured for lookups in d6_custom_block and
* d7_custom_block.
*
* @var \Drupal\migrate\Plugin\MigrateProcessInterface
*
* @deprecated in drupal:8.8.x and is removed from drupal:9.0.0. Use
* the migrate.lookup service instead.
*
* @see https://www.drupal.org/node/3047268
*/
protected $migrationPlugin;
/**
* The migrate lookup service.
*
* @var \Drupal\migrate\MigrateLookupInterface
*/
protected $migrateLookup;
/**
* The block_content entity storage handler.
*
@ -34,12 +49,32 @@ class BlockPluginId extends ProcessPluginBase implements ContainerFactoryPluginI
protected $blockContentStorage;
/**
* {@inheritdoc}
* Constructs a BlockPluginId object.
*
* @param array $configuration
* The plugin configuration.
* @param string $plugin_id
* The plugin ID.
* @param mixed $plugin_definition
* The plugin definition.
* @param \Drupal\Core\Entity\EntityStorageInterface $storage
* The block content storage object.
* @param \Drupal\migrate\MigrateLookupInterface $migrate_lookup
* The migrate lookup service.
*/
public function __construct(array $configuration, $plugin_id, array $plugin_definition, EntityStorageInterface $storage, MigrateProcessInterface $migration_plugin) {
// @codingStandardsIgnoreLine
public function __construct(array $configuration, $plugin_id, array $plugin_definition, EntityStorageInterface $storage, $migrate_lookup) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
if ($migrate_lookup instanceof MigrateProcessInterface) {
@trigger_error('Passing a migration process plugin as the fifth argument to ' . __METHOD__ . ' is deprecated in drupal:8.8.0 and will throw an error in drupal:9.0.0. Pass the migrate.lookup service instead. See https://www.drupal.org/node/3047268', E_USER_DEPRECATED);
$this->migrationPlugin = $migrate_lookup;
$migrate_lookup = \Drupal::service('migrate.lookup');
}
elseif (!$migrate_lookup instanceof MigrateLookupInterface) {
throw new \InvalidArgumentException("The fifth argument to " . __METHOD__ . " must be an instance of MigrateLookupInterface.");
}
$this->blockContentStorage = $storage;
$this->migrationPlugin = $migration_plugin;
$this->migrateLookup = $migrate_lookup;
}
/**
@ -47,18 +82,12 @@ class BlockPluginId extends ProcessPluginBase implements ContainerFactoryPluginI
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
$entity_type_manager = $container->get('entity_type.manager');
$migration_configuration = [
'migration' => [
'd6_custom_block',
'd7_custom_block',
],
];
return new static(
$configuration,
$plugin_id,
$plugin_definition,
$entity_type_manager->getDefinition('block_content') ? $entity_type_manager->getStorage('block_content') : NULL,
$container->get('plugin.manager.migrate.process')->createInstance('migration', $migration_configuration, $migration)
$container->get('migrate.lookup')
);
}
@ -77,17 +106,35 @@ class BlockPluginId extends ProcessPluginBase implements ContainerFactoryPluginI
return 'aggregator_feed_block';
}
break;
case 'menu':
return "system_menu_block:$delta";
case 'block':
if ($this->blockContentStorage) {
$block_id = $this->migrationPlugin
->transform($delta, $migrate_executable, $row, $destination_property);
if ($block_id) {
// This BC layer is included because if the plugin constructor was
// called in the legacy way with a migration_lookup process plugin,
// it may have been preconfigured with a different migration to
// look up against. While this is unlikely, for maximum BC we will
// continue to use the plugin to do the lookup if it is provided,
// and support for this will be removed in Drupal 9.
if ($this->migrationPlugin) {
$block_id = $this->migrationPlugin
->transform($delta, $migrate_executable, $row, $destination_property);
}
else {
$lookup_result = $this->migrateLookup->lookup(['d6_custom_block', 'd7_custom_block'], [$delta]);
if ($lookup_result) {
$block_id = $lookup_result[0]['id'];
}
}
if (!empty($block_id)) {
return 'block_content:' . $this->blockContentStorage->load($block_id)->uuid();
}
}
break;
default:
break;
}

View File

@ -4,6 +4,7 @@ namespace Drupal\block\Plugin\migrate\process;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\migrate\MigrateLookupInterface;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\MigrateSkipRowException;
@ -27,13 +28,27 @@ class BlockVisibility extends ProcessPluginBase implements ContainerFactoryPlugi
protected $moduleHandler;
/**
* The migration process plugin, configured for lookups in the d6_user_role
* and d7_user_role migrations.
* The migration process plugin.
*
* The plugin is configured for lookups in the d6_user_role and d7_user_role
* migrations.
*
* @var \Drupal\migrate\Plugin\MigrateProcessInterface
*
* @deprecated in drupal:8.8.x and is removed from drupal:9.0.0. Use
* the migrate.lookup service instead.
*
* @see https://www.drupal.org/node/3047268
*/
protected $migrationPlugin;
/**
* The migrate lookup service.
*
* @var \Drupal\migrate\MigrateLookupInterface
*/
protected $migrateLookup;
/**
* Whether or not to skip blocks that use PHP for visibility. Only applies
* if the PHP module is not enabled.
@ -43,12 +58,32 @@ class BlockVisibility extends ProcessPluginBase implements ContainerFactoryPlugi
protected $skipPHP = FALSE;
/**
* {@inheritdoc}
* Constructs a BlockVisibility object.
*
* @param array $configuration
* The plugin configuration.
* @param string $plugin_id
* The plugin ID.
* @param mixed $plugin_definition
* The plugin definition.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler service.
* @param \Drupal\migrate\MigrateLookupInterface $migrate_lookup
* The migrate lookup service.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, ModuleHandlerInterface $module_handler, MigrateProcessInterface $migration_plugin) {
// @codingStandardsIgnoreLine
public function __construct(array $configuration, $plugin_id, $plugin_definition, ModuleHandlerInterface $module_handler, $migrate_lookup) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
if ($migrate_lookup instanceof MigrateProcessInterface) {
@trigger_error('Passing a migration process plugin as the fifth argument to ' . __METHOD__ . ' is deprecated in drupal:8.8.0 and will throw an error in drupal:9.0.0. Pass the migrate.lookup service instead. See https://www.drupal.org/node/3047268', E_USER_DEPRECATED);
$this->migrationPlugin = $migrate_lookup;
$migrate_lookup = \Drupal::service('migrate.lookup');
}
elseif (!$migrate_lookup instanceof MigrateLookupInterface) {
throw new \InvalidArgumentException("The fifth argument to " . __METHOD__ . " must be an instance of MigrateLookupInterface.");
}
$this->moduleHandler = $module_handler;
$this->migrationPlugin = $migration_plugin;
$this->migrateLookup = $migrate_lookup;
if (isset($configuration['skip_php'])) {
$this->skipPHP = $configuration['skip_php'];
@ -59,18 +94,12 @@ class BlockVisibility extends ProcessPluginBase implements ContainerFactoryPlugi
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
$migration_configuration = [
'migration' => [
'd6_user_role',
'd7_user_role',
],
];
return new static(
$configuration,
$plugin_id,
$plugin_definition,
$container->get('module_handler'),
$container->get('plugin.manager.migrate.process')->createInstance('migration', $migration_configuration, $migration)
$container->get('migrate.lookup')
);
}
@ -94,7 +123,22 @@ class BlockVisibility extends ProcessPluginBase implements ContainerFactoryPlugi
];
foreach ($roles as $key => $role_id) {
$roles[$key] = $this->migrationPlugin->transform($role_id, $migrate_executable, $row, $destination_property);
// This BC layer is included because if the plugin constructor was
// called in the legacy way with a migration_lookup process plugin, it
// may have been preconfigured with a different migration to look up
// against. While this is unlikely, for maximum BC we will continue to
// use the plugin to do the lookup if it is provided, and support for
// this will be removed in Drupal 9.
if ($this->migrationPlugin) {
$roles[$key] = $this->migrationPlugin->transform($role_id, $migrate_executable, $row, $destination_property);
}
else {
$lookup_result = $this->migrateLookup->lookup(['d6_user_role', 'd7_user_role'], [$role_id]);
if ($lookup_result) {
$roles[$key] = $lookup_result[0]['id'];
}
}
}
$visibility['user_role']['roles'] = array_combine($roles, $roles);
}

View File

@ -4,8 +4,8 @@ namespace Drupal\Tests\block\Unit\Plugin\migrate\process;
use Drupal\block\Plugin\migrate\process\BlockVisibility;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\migrate\MigrateLookupInterface;
use Drupal\migrate\MigrateSkipRowException;
use Drupal\migrate\Plugin\MigrateProcessInterface;
use Drupal\Tests\migrate\Unit\process\MigrateProcessTestCase;
/**
@ -29,8 +29,8 @@ class BlockVisibilityTest extends MigrateProcessTestCase {
protected function setUp() {
parent::setUp();
$this->moduleHandler = $this->prophesize(ModuleHandlerInterface::class);
$migration_plugin = $this->prophesize(MigrateProcessInterface::class);
$this->plugin = new BlockVisibility([], 'block_visibility_pages', [], $this->moduleHandler->reveal(), $migration_plugin->reveal());
$migrate_lookup = $this->prophesize(MigrateLookupInterface::class);
$this->plugin = new BlockVisibility([], 'block_visibility_pages', [], $this->moduleHandler->reveal(), $migrate_lookup->reveal());
}
/**
@ -86,7 +86,7 @@ class BlockVisibilityTest extends MigrateProcessTestCase {
*/
public function testTransformException() {
$this->moduleHandler->moduleExists('php')->willReturn(FALSE);
$migration_plugin = $this->prophesize(MigrateProcessInterface::class);
$migrate_lookup = $this->prophesize(MigrateLookupInterface::class);
$this->row = $this->getMockBuilder('Drupal\migrate\Row')
->disableOriginalConstructor()
->setMethods(['getSourceProperty'])
@ -94,7 +94,7 @@ class BlockVisibilityTest extends MigrateProcessTestCase {
$this->row->expects($this->exactly(2))
->method('getSourceProperty')
->willReturnMap([['bid', 99], ['module', 'foobar']]);
$this->plugin = new BlockVisibility(['skip_php' => TRUE], 'block_visibility_pages', [], $this->moduleHandler->reveal(), $migration_plugin->reveal());
$this->plugin = new BlockVisibility(['skip_php' => TRUE], 'block_visibility_pages', [], $this->moduleHandler->reveal(), $migrate_lookup->reveal());
$this->expectException(MigrateSkipRowException::class);
$this->expectExceptionMessage("The block with bid '99' from module 'foobar' will have no PHP or request_path visibility configuration.");
$this->plugin->transform([2, '<?php', []], $this->migrateExecutable, $this->row, 'destinationproperty');

View File

@ -0,0 +1,50 @@
<?php
namespace Drupal\Tests\block\Unit\Plugin\migrate\process;
use Drupal\block\Plugin\migrate\process\BlockPluginId;
use Drupal\block_content\Entity\BlockContent;
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\migrate\MigrateLookupInterface;
use Drupal\migrate\Plugin\MigrateProcessInterface;
use Drupal\Tests\migrate\Unit\process\MigrateProcessTestCase;
/**
* Tests legacy usage of BlockPluginId.
*
* @group block
* @group legacy
*
* @coversDefaultClass \Drupal\block\Plugin\migrate\process\BlockPluginId
*/
class LegacyBlockPluginIdTest extends MigrateProcessTestCase {
/**
* {@inheritdoc}
*/
public function setUp() {
parent::setUp();
$migrate_lookup = $this->prophesize(MigrateLookupInterface::class);
$container = new ContainerBuilder();
$container->set('migrate.lookup', $migrate_lookup->reveal());
\Drupal::setContainer($container);
}
/**
* Tests legacy construction.
*
* @expectedDeprecation Passing a migration process plugin as the fifth argument to Drupal\block\Plugin\migrate\process\BlockPluginId::__construct is deprecated in drupal:8.8.0 and will throw an error in drupal:9.0.0. Pass the migrate.lookup service instead. See https://www.drupal.org/node/3047268
*/
public function testConstruct() {
$process_plugin = $this->prophesize(MigrateProcessInterface::class);
$process_plugin->transform(1, $this->migrateExecutable, $this->row, 'destination_property')->willReturn(3);
$block = $this->prophesize(BlockContent::class);
$block->uuid()->willReturn('123456789');
$storage = $this->prophesize(EntityStorageInterface::class);
$storage->load(3)->willReturn($block->reveal());
$plugin = new BlockPluginId([], '', [], $storage->reveal(), $process_plugin->reveal());
$this->assertSame('block_content:123456789', $plugin->transform(['block', 1], $this->migrateExecutable, $this->row, 'destination_property'));
}
}

View File

@ -0,0 +1,135 @@
<?php
namespace Drupal\Tests\block\Unit\Plugin\migrate\process;
use Drupal\block\Plugin\migrate\process\BlockVisibility;
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\migrate\MigrateLookupInterface;
use Drupal\migrate\MigrateSkipRowException;
use Drupal\migrate\Plugin\MigrateProcessInterface;
use Drupal\Tests\migrate\Unit\process\MigrateProcessTestCase;
/**
* Tests the block_visibility process plugin.
*
* @coversDefaultClass \Drupal\block\Plugin\migrate\process\BlockVisibility
*
* @group block
* @group legacy
*/
class LegacyBlockVisibilityTest extends MigrateProcessTestCase {
/**
* The module handler.
*
* @var \Drupal\Core\Extension\ModuleHandlerInterface
*/
protected $moduleHandler;
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$migrate_lookup = $this->prophesize(MigrateLookupInterface::class);
$container = new ContainerBuilder();
$container->set('migrate.lookup', $migrate_lookup->reveal());
\Drupal::setContainer($container);
$this->moduleHandler = $this->prophesize(ModuleHandlerInterface::class);
$migration_plugin = $this->prophesize(MigrateProcessInterface::class);
$this->plugin = new BlockVisibility([], 'block_visibility_pages', [], $this->moduleHandler->reveal(), $migration_plugin->reveal());
}
/**
* Tests Transform.
*
* @covers ::transform
*
* @expectedDeprecation Passing a migration process plugin as the fifth argument to Drupal\block\Plugin\migrate\process\BlockVisibility::__construct is deprecated in drupal:8.8.0 and will throw an error in drupal:9.0.0. Pass the migrate.lookup service instead. See https://www.drupal.org/node/3047268
*/
public function testTransformNoData() {
$transformed_value = $this->plugin->transform([0, '', []], $this->migrateExecutable, $this->row, 'destinationproperty');
$this->assertEmpty($transformed_value);
}
/**
* Tests Transform.
*
* @covers ::transform
*
* @expectedDeprecation Passing a migration process plugin as the fifth argument to Drupal\block\Plugin\migrate\process\BlockVisibility::__construct is deprecated in drupal:8.8.0 and will throw an error in drupal:9.0.0. Pass the migrate.lookup service instead. See https://www.drupal.org/node/3047268
*/
public function testTransformSinglePageWithFront() {
$visibility = $this->plugin->transform([0, '<front>', []], $this->migrateExecutable, $this->row, 'destinationproperty');
$this->assertSame('request_path', $visibility['request_path']['id']);
$this->assertTrue($visibility['request_path']['negate']);
$this->assertSame('<front>', $visibility['request_path']['pages']);
}
/**
* Tests Transform.
*
* @covers ::transform
*
* @expectedDeprecation Passing a migration process plugin as the fifth argument to Drupal\block\Plugin\migrate\process\BlockVisibility::__construct is deprecated in drupal:8.8.0 and will throw an error in drupal:9.0.0. Pass the migrate.lookup service instead. See https://www.drupal.org/node/3047268
*/
public function testTransformMultiplePagesWithFront() {
$visibility = $this->plugin->transform([1, "foo\n/bar\rbaz\r\n<front>", []], $this->migrateExecutable, $this->row, 'destinationproperty');
$this->assertSame('request_path', $visibility['request_path']['id']);
$this->assertFalse($visibility['request_path']['negate']);
$this->assertSame("/foo\n/bar\n/baz\n<front>", $visibility['request_path']['pages']);
}
/**
* Tests Transform.
*
* @covers ::transform
*
* @expectedDeprecation Passing a migration process plugin as the fifth argument to Drupal\block\Plugin\migrate\process\BlockVisibility::__construct is deprecated in drupal:8.8.0 and will throw an error in drupal:9.0.0. Pass the migrate.lookup service instead. See https://www.drupal.org/node/3047268
*/
public function testTransformPhpEnabled() {
$this->moduleHandler->moduleExists('php')->willReturn(TRUE);
$visibility = $this->plugin->transform([2, '<?php', []], $this->migrateExecutable, $this->row, 'destinationproperty');
$this->assertSame('php', $visibility['php']['id']);
$this->assertFalse($visibility['php']['negate']);
$this->assertSame('<?php', $visibility['php']['php']);
}
/**
* Tests Transform.
*
* @covers ::transform
*
* @expectedDeprecation Passing a migration process plugin as the fifth argument to Drupal\block\Plugin\migrate\process\BlockVisibility::__construct is deprecated in drupal:8.8.0 and will throw an error in drupal:9.0.0. Pass the migrate.lookup service instead. See https://www.drupal.org/node/3047268
*/
public function testTransformPhpDisabled() {
$this->moduleHandler->moduleExists('php')->willReturn(FALSE);
$transformed_value = $this->plugin->transform([2, '<?php', []], $this->migrateExecutable, $this->row, 'destinationproperty');
$this->assertEmpty($transformed_value);
}
/**
* Tests Transform.
*
* @covers ::transform
*
* @expectedDeprecation Passing a migration process plugin as the fifth argument to Drupal\block\Plugin\migrate\process\BlockVisibility::__construct is deprecated in drupal:8.8.0 and will throw an error in drupal:9.0.0. Pass the migrate.lookup service instead. See https://www.drupal.org/node/3047268
*/
public function testTransformException() {
$this->moduleHandler->moduleExists('php')->willReturn(FALSE);
$migration_plugin = $this->prophesize(MigrateProcessInterface::class);
$this->row = $this->getMockBuilder('Drupal\migrate\Row')
->disableOriginalConstructor()
->setMethods(['getSourceProperty'])
->getMock();
$this->row->expects($this->exactly(2))
->method('getSourceProperty')
->willReturnMap([['bid', 99], ['module', 'foobar']]);
$this->plugin = new BlockVisibility(['skip_php' => TRUE], 'block_visibility_pages', [], $this->moduleHandler->reveal(), $migration_plugin->reveal());
$this->expectException(MigrateSkipRowException::class);
$this->expectExceptionMessage("The block with bid '99' from module 'foobar' will have no PHP or request_path visibility configuration.");
$this->plugin->transform([2, '<?php', []], $this->migrateExecutable, $this->row, 'destinationproperty');
}
}

View File

@ -13,7 +13,7 @@ process:
tid: tid
langcode: language
vid:
plugin: migration
plugin: migration_lookup
migration: d6_taxonomy_vocabulary
source: vid
name:

View File

@ -13,7 +13,7 @@ process:
tid: tid
langcode: language
vid:
plugin: migration
plugin: migration_lookup
migration: d6_taxonomy_vocabulary
source: vid
name: name
@ -26,7 +26,7 @@ process:
method: process
source: parent
-
plugin: migration
plugin: migration_lookup
migration: d6_taxonomy_term
parent:
plugin: default_value

View File

@ -14,7 +14,7 @@ process:
# Use the language from the locales_target table.
langcode: ltlanguage
vid:
plugin: migration
plugin: migration_lookup
migration: d7_taxonomy_vocabulary
source: vid
name:

View File

@ -25,7 +25,7 @@ process:
tid: tid
langcode: language
vid:
plugin: migration
plugin: migration_lookup
migration: d7_taxonomy_vocabulary
source: vid
name: name
@ -39,7 +39,7 @@ process:
method: process
source: parent
-
plugin: migration
plugin: migration_lookup
migration: d7_taxonomy_term
parent:
plugin: default_value

View File

@ -3,6 +3,7 @@
namespace Drupal\file\Plugin\migrate\process\d6;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\migrate\MigrateLookupInterface;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\Plugin\MigrateProcessInterface;
@ -21,9 +22,21 @@ class FieldFile extends ProcessPluginBase implements ContainerFactoryPluginInter
* The migration process plugin, configured for lookups in d6_file.
*
* @var \Drupal\migrate\Plugin\MigrateProcessInterface
*
* @deprecated in drupal:8.8.x and is removed from drupal:9.0.0. Use
* the migrate.lookup service instead.
*
* @see https://www.drupal.org/node/3047268
*/
protected $migrationPlugin;
/**
* The migrate lookup service.
*
* @var \Drupal\migrate\MigrateLookupInterface
*/
protected $migrateLookup;
/**
* Constructs a FieldFile plugin instance.
*
@ -35,32 +48,36 @@ class FieldFile extends ProcessPluginBase implements ContainerFactoryPluginInter
* The plugin definition.
* @param \Drupal\migrate\Plugin\MigrationInterface $migration
* The current migration.
* @param \Drupal\migrate\Plugin\MigrateProcessInterface $migration_plugin
* An instance of the 'migration' process plugin.
* @param \Drupal\migrate\MigrateLookupInterface $migrate_lookup
* The migrate lookup service.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, MigrateProcessInterface $migration_plugin) {
// @codingStandardsIgnoreLine
public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, $migrate_lookup) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
if ($migrate_lookup instanceof MigrateProcessInterface) {
@trigger_error('Passing a migration process plugin as the fourth argument to ' . __METHOD__ . ' is deprecated in drupal:8.8.0 and will throw an error in drupal:9.0.0. Pass the migrate.lookup service instead. See https://www.drupal.org/node/3047268', E_USER_DEPRECATED);
$this->migrationPlugin = $migrate_lookup;
$migrate_lookup = \Drupal::service('migrate.lookup');
}
elseif (!$migrate_lookup instanceof MigrateLookupInterface) {
throw new \InvalidArgumentException("The fifth argument to " . __METHOD__ . " must be an instance of MigrateLookupInterface.");
}
$this->migration = $migration;
$this->migrationPlugin = $migration_plugin;
$this->migrateLookup = $migrate_lookup;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
// Configure the migration process plugin to look up migrated IDs from
// a d6 file migration.
$migration_plugin_configuration = $configuration + [
'migration' => 'd6_file',
'source' => ['fid'],
];
return new static(
$configuration,
$plugin_id,
$plugin_definition,
$migration,
$container->get('plugin.manager.migrate.process')->createInstance('migration', $migration_plugin_configuration, $migration)
$container->get('migrate.lookup')
);
}
@ -75,7 +92,22 @@ class FieldFile extends ProcessPluginBase implements ContainerFactoryPluginInter
// some reason -- file migration is notoriously brittle -- and we do NOT
// want to send invalid file references into the field system (it causes
// fatals), so return an empty item instead.
if ($fid = $this->migrationPlugin->transform($value['fid'], $migrate_executable, $row, $destination_property)) {
// This BC layer is included because if the plugin constructor was called
// in the legacy way with a migration_lookup process plugin, it may have
// been preconfigured with a different migration to look up against. While
// this is unlikely, for maximum BC we will continue to use the plugin to do
// the lookup if it is provided, and support for this will be removed in
// Drupal 9.
if ($this->migrationPlugin) {
$fid = $this->migrationPlugin->transform($value['fid'], $migrate_executable, $row, $destination_property);
}
else {
$lookup_result = $this->migrateLookup->lookup('d6_file', [$value['fid']]);
if ($lookup_result) {
$fid = $lookup_result[0]['fid'];
}
}
if (!empty($fid)) {
return [
'target_id' => $fid,
'display' => $value['list'],

View File

@ -25,8 +25,7 @@ class CckFileTest extends MigrateDrupalTestBase {
public function testConfigurableFileMigration() {
$migration = Migration::create($this->container, [], 'custom_migration', []);
$cck_file_migration = CckFile::create($this->container, ['migration' => 'custom_file'], 'custom_file', [], $migration);
$migration_plugin = $this->readAttribute($cck_file_migration, 'migrationPlugin');
$config = $this->readAttribute($migration_plugin, 'configuration');
$config = $this->readAttribute($cck_file_migration, 'configuration');
$this->assertEquals($config['migration'], 'custom_file');
}

View File

@ -2,7 +2,9 @@
namespace Drupal\Tests\file\Unit\Plugin\migrate\process\d6;
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\file\Plugin\migrate\process\d6\CckFile;
use Drupal\migrate\MigrateLookupInterface;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\Plugin\MigrateProcessInterface;
@ -21,6 +23,10 @@ class CckFileTest extends UnitTestCase {
* @expectedDeprecation CckFile is deprecated in Drupal 8.3.x and will be be removed before Drupal 9.0.x. Use \Drupal\file\Plugin\migrate\process\d6\FieldFile instead.
*/
public function testTransformAltTitle() {
$migrate_lookup = $this->prophesize(MigrateLookupInterface::class);
$container = new ContainerBuilder();
$container->set('migrate.lookup', $migrate_lookup->reveal());
\Drupal::setContainer($container);
$executable = $this->prophesize(MigrateExecutableInterface::class)->reveal();
$row = $this->prophesize(Row::class)->reveal();
$migration = $this->prophesize(MigrationInterface::class)->reveal();

View File

@ -2,7 +2,9 @@
namespace Drupal\Tests\file\Unit\Plugin\migrate\process\d6;
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\file\Plugin\migrate\process\d6\FieldFile;
use Drupal\migrate\MigrateLookupInterface;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\Plugin\MigrateProcessInterface;
@ -22,6 +24,49 @@ class FieldFileTest extends UnitTestCase {
$row = $this->prophesize(Row::class)->reveal();
$migration = $this->prophesize(MigrationInterface::class)->reveal();
$migrate_lookup = $this->prophesize(MigrateLookupInterface::class);
$migrate_lookup->lookup('d6_file', [1])->willReturn([['fid' => 1]]);
$plugin = new FieldFile([], 'd6_file', [], $migration, $migrate_lookup->reveal());
$options = [
'alt' => 'Foobaz',
'title' => 'Wambooli',
];
$value = [
'fid' => 1,
'list' => TRUE,
'data' => serialize($options),
];
$transformed = $plugin->transform($value, $executable, $row, 'foo');
$expected = [
'target_id' => 1,
'display' => TRUE,
'description' => '',
'alt' => 'Foobaz',
'title' => 'Wambooli',
];
$this->assertSame($expected, $transformed);
}
/**
* Tests that alt and title attributes are included in transformed values.
*
* @group legacy
*
* @expectedDeprecation Passing a migration process plugin as the fourth argument to Drupal\file\Plugin\migrate\process\d6\FieldFile::__construct is deprecated in drupal:8.8.0 and will throw an error in drupal:9.0.0. Pass the migrate.lookup service instead. See https://www.drupal.org/node/3047268
*/
public function testLegacyTransformAltTitle() {
$migrate_lookup = $this->prophesize(MigrateLookupInterface::class);
$container = new ContainerBuilder();
$container->set('migrate.lookup', $migrate_lookup->reveal());
\Drupal::setContainer($container);
$executable = $this->prophesize(MigrateExecutableInterface::class)->reveal();
$row = $this->prophesize(Row::class)->reveal();
$migration = $this->prophesize(MigrationInterface::class)->reveal();
$migration_plugin = $this->prophesize(MigrateProcessInterface::class);
$migration_plugin->transform(1, $executable, $row, 'foo')->willReturn(1);

View File

@ -3,6 +3,7 @@
namespace Drupal\filter\Plugin\migrate\process\d6;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\migrate\MigrateLookupInterface;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\Plugin\MigrateProcessInterface;
@ -21,35 +22,64 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
class FilterFormatPermission extends ProcessPluginBase implements ContainerFactoryPluginInterface {
/**
* The migration plugin.
* The Migration process plugin.
*
* @var \Drupal\migrate\Plugin\MigrateProcessInterface
*
* @deprecated in drupal:8.8.x and is removed from drupal:9.0.0. Use
* the migrate.lookup service instead.
*
* @see https://www.drupal.org/node/3047268
*/
protected $migrationPlugin;
/**
* {@inheritdoc}
* The migrate lookup service.
*
* @var \Drupal\migrate\MigrateLookupInterface
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, MigrateProcessInterface $migration_plugin) {
protected $migrateLookup;
/**
* Constructs a FilterFormatPermission plugin instance.
*
* @param array $configuration
* The plugin configuration.
* @param string $plugin_id
* The plugin ID.
* @param mixed $plugin_definition
* The plugin definition.
* @param \Drupal\migrate\Plugin\MigrationInterface $migration
* The current migration.
* @param \Drupal\migrate\MigrateLookupInterface $migrate_lookup
* The migrate lookup service.
*/
// @codingStandardsIgnoreLine
public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, $migrate_lookup) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
if ($migrate_lookup instanceof MigrateProcessInterface) {
@trigger_error('Passing a migration process plugin as the fourth argument to ' . __METHOD__ . ' is deprecated in drupal:8.8.0 and will throw an error in drupal:9.0.0. Pass the migrate.lookup service instead. See https://www.drupal.org/node/3047268', E_USER_DEPRECATED);
$this->migrationPlugin = $migrate_lookup;
$migrate_lookup = \Drupal::service('migrate.lookup');
}
elseif (!$migrate_lookup instanceof MigrateLookupInterface) {
throw new \InvalidArgumentException("The fifth argument to " . __METHOD__ . " must be an instance of MigrateLookupInterface.");
}
$this->migration = $migration;
$this->migrationPlugin = $migration_plugin;
$this->migrateLookup = $migrate_lookup;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
$migration_plugin_configuration = $configuration + [
'migration' => 'd6_filter_format',
];
return new static(
$configuration,
$plugin_id,
$plugin_definition,
$migration,
$container->get('plugin.manager.migrate.process')->createInstance('migration', $migration_plugin_configuration, $migration)
$container->get('migrate.lookup')
);
}
@ -60,10 +90,26 @@ class FilterFormatPermission extends ProcessPluginBase implements ContainerFacto
*/
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
$rid = $row->getSourceProperty('rid');
$migration = isset($this->configuration['migration']) ? $this->configuration['migration'] : 'd6_filter_format';
if ($formats = $row->getSourceProperty("filter_permissions:$rid")) {
foreach ($formats as $format) {
$new_id = $this->migrationPlugin->transform($format, $migrate_executable, $row, $destination_property);
if ($new_id) {
// This BC layer is included because if the plugin constructor was
// called in the legacy way with a migration_lookup process plugin, it
// may have been preconfigured with a different migration to look up
// against. While this is unlikely, for maximum BC we will continue to
// use the plugin to do the lookup if it is provided, and support for
// this will be removed in Drupal 9.
if ($this->migrationPlugin) {
$new_id = $this->migrationPlugin->transform($format, $migrate_executable, $row, $destination_property);
}
else {
$lookup_result = $this->migrateLookup->lookup($migration, [$format]);
if ($lookup_result) {
$new_id = $lookup_result[0]['format'];
}
}
if (!empty($new_id)) {
$value[] = 'use text format ' . $new_id;
}
}

View File

@ -3,7 +3,9 @@
namespace Drupal\Tests\filter\Kernel\Migrate\d6;
use Drupal\filter\Plugin\migrate\process\d6\FilterFormatPermission;
use Drupal\migrate\Plugin\MigrateProcessInterface;
use Drupal\migrate\Plugin\Migration;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalTestBase;
/**
@ -23,10 +25,21 @@ class FilterFormatPermissionTest extends MigrateDrupalTestBase {
public function testConfigurableFilterFormat() {
$migration = Migration::create($this->container, [], 'custom_migration', []);
$filterFormatPermissionMigration = FilterFormatPermission::create($this->container, ['migration' => 'custom_filter_format'], 'custom_filter_format', [], $migration);
$migrationPlugin = $this->readAttribute($filterFormatPermissionMigration, 'migrationPlugin');
$config = $this->readAttribute($migrationPlugin, 'configuration');
$config = $this->readAttribute($filterFormatPermissionMigration, 'configuration');
$this->assertEquals($config['migration'], 'custom_filter_format');
}
/**
* Tests legacy plugin usage.
*
* @group legacy
*
* @expectedDeprecation Passing a migration process plugin as the fourth argument to Drupal\filter\Plugin\migrate\process\d6\FilterFormatPermission::__construct is deprecated in drupal:8.8.0 and will throw an error in drupal:9.0.0. Pass the migrate.lookup service instead. See https://www.drupal.org/node/3047268
*/
public function testLegacyConstruct() {
$process_plugin = $this->prophesize(MigrateProcessInterface::class)->reveal();
$plugin = new FilterFormatPermission([], '', [], $this->prophesize(MigrationInterface::class)->reveal(), $process_plugin);
$this->assertSame($process_plugin, $this->readAttribute($plugin, 'migrationPlugin'));
}
}

View File

@ -7,6 +7,7 @@ use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Menu\MenuLinkManagerInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Url;
use Drupal\migrate\MigrateLookupInterface;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\MigrateSkipRowException;
@ -30,21 +31,70 @@ class MenuLinkParent extends ProcessPluginBase implements ContainerFactoryPlugin
protected $menuLinkManager;
/**
* The Migration process plugin.
*
* @var \Drupal\migrate\Plugin\MigrateProcessInterface
*
* @deprecated in drupal:8.8.x and is removed from drupal:9.0.0. Use
* the migrate.lookup service instead.
*
* @see https://www.drupal.org/node/3047268
*/
protected $migrationPlugin;
/**
* The currently running migration.
*
* @var \Drupal\migrate\Plugin\MigrationInterface
*/
protected $migration;
/**
* The migrate lookup service.
*
* @var \Drupal\migrate\MigrateLookupInterface
*/
protected $migrateLookup;
/**
* @var \Drupal\Core\Entity\EntityStorageInterface
*/
protected $menuLinkStorage;
/**
* {@inheritdoc}
* Constructs a MenuLinkParent object.
*
* @param array $configuration
* A configuration array containing information about the plugin instance.
* @param string $plugin_id
* The plugin_id for the plugin instance.
* @param mixed $plugin_definition
* The plugin implementation definition.
* @param \Drupal\migrate\MigrateLookupInterface $migrate_lookup
* The migrate lookup service.
* @param \Drupal\Core\Menu\MenuLinkManagerInterface $menu_link_manager
* The menu link manager.
* @param \Drupal\Core\Entity\EntityStorageInterface $menu_link_storage
* The menu link storage object.
* @param \Drupal\migrate\Plugin\MigrationInterface $migration
* The currently running migration.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrateProcessInterface $migration_plugin, MenuLinkManagerInterface $menu_link_manager, EntityStorageInterface $menu_link_storage) {
// @codingStandardsIgnoreLine
public function __construct(array $configuration, $plugin_id, $plugin_definition, $migrate_lookup, MenuLinkManagerInterface $menu_link_manager, EntityStorageInterface $menu_link_storage, MigrationInterface $migration = NULL) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->migrationPlugin = $migration_plugin;
if ($migrate_lookup instanceof MigrateProcessInterface) {
@trigger_error('Passing a migration process plugin as the fourth argument to ' . __METHOD__ . ' is deprecated in drupal:8.8.0 and will throw an error in drupal:9.0.0. Pass the migrate.lookup service instead. See https://www.drupal.org/node/3047268', E_USER_DEPRECATED);
$this->migrationPlugin = $migrate_lookup;
$migrate_lookup = \Drupal::service('migrate.lookup');
}
elseif (!$migrate_lookup instanceof MigrateLookupInterface) {
throw new \InvalidArgumentException("The fourth argument to " . __METHOD__ . " must be an instance of MigrateLookupInterface.");
}
elseif (!$migration instanceof MigrationInterface) {
throw new \InvalidArgumentException("The seventh argument to " . __METHOD__ . " must be an instance of MigrationInterface.");
}
$this->migration = $migration;
$this->migrateLookup = $migrate_lookup;
$this->menuLinkManager = $menu_link_manager;
$this->menuLinkStorage = $menu_link_storage;
}
@ -58,9 +108,10 @@ class MenuLinkParent extends ProcessPluginBase implements ContainerFactoryPlugin
$configuration,
$plugin_id,
$plugin_definition,
$container->get('plugin.manager.migrate.process')->createInstance('migration', $migration_configuration, $migration),
$container->get('migrate.lookup'),
$container->get('plugin.manager.menu.link'),
$container->get('entity_type.manager')->getStorage('menu_link_content')
$container->get('entity_type.manager')->getStorage('menu_link_content'),
$migration
);
}
@ -75,16 +126,30 @@ class MenuLinkParent extends ProcessPluginBase implements ContainerFactoryPlugin
// Top level item.
return '';
}
try {
$already_migrated_id = $this
->migrationPlugin
->transform($parent_id, $migrate_executable, $row, $destination_property);
if ($already_migrated_id && ($link = $this->menuLinkStorage->load($already_migrated_id))) {
return $link->getPluginId();
// This BC layer is included because if the plugin constructor was called
// in the legacy way with a migration_lookup process plugin, it may have
// been preconfigured with a different migration to look up against. While
// this is unlikely, for maximum BC we will continue to use the plugin to do
// the lookup if it is provided, and support for this will be removed in
// Drupal 9.
if ($this->migrationPlugin) {
try {
$already_migrated_id = $this
->migrationPlugin
->transform($parent_id, $migrate_executable, $row, $destination_property);
}
catch (MigrateSkipRowException $e) {
}
}
else {
$lookup_result = $this->migrateLookup->lookup($this->migration->id(), [$parent_id]);
if ($lookup_result) {
$already_migrated_id = $lookup_result[0]['id'];
}
}
catch (MigrateSkipRowException $e) {
if (!empty($already_migrated_id) && ($link = $this->menuLinkStorage->load($already_migrated_id))) {
return $link->getPluginId();
}
if (isset($value[1])) {

View File

@ -3,12 +3,15 @@
namespace Drupal\Tests\migrate\Unit\process;
use Drupal\Component\Plugin\PluginInspectionInterface;
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Menu\MenuLinkManagerInterface;
use Drupal\menu_link_content\MenuLinkContentInterface;
use Drupal\migrate\MigrateLookupInterface;
use Drupal\migrate\MigrateSkipRowException;
use Drupal\migrate\Plugin\migrate\process\MenuLinkParent;
use Drupal\migrate\Plugin\MigrateProcessInterface;
use Drupal\migrate\Plugin\MigrationInterface;
/**
* Tests the menu link parent process plugin.
@ -18,24 +21,58 @@ use Drupal\migrate\Plugin\MigrateProcessInterface;
*/
class MenuLinkParentTest extends MigrateProcessTestCase {
/**
* A MigrationInterface prophecy.
*
* @var \Prophecy\Prophecy\ObjectProphecy
*/
protected $migration;
/**
* A MigrateLookupInterface prophecy.
*
* @var \Prophecy\Prophecy\ObjectProphecy
*/
protected $migrateLookup;
/**
* A MigrationInterface prophecy.
*
* @var \Prophecy\Prophecy\ObjectProphecy
*/
protected $menuLinkManager;
/**
* A MigrationInterface prophecy.
*
* @var \Prophecy\Prophecy\ObjectProphecy
*/
protected $menuLinkStorage;
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$migration_plugin = $this->prophesize(MigrateProcessInterface::class);
$menu_link_manager = $this->prophesize(MenuLinkManagerInterface::class);
$menu_link_storage = $this->prophesize(EntityStorageInterface::class);
$this->plugin = new MenuLinkParent([], 'map', [], $migration_plugin->reveal(), $menu_link_manager->reveal(), $menu_link_storage->reveal());
$this->migration = $this->prophesize(MigrationInterface::class);
$this->migrateLookup = $this->prophesize(MigrateLookupInterface::class);
$this->migrateLookup->lookup(NULL, [1])->willReturn([]);
$this->menuLinkManager = $this->prophesize(MenuLinkManagerInterface::class);
$this->menuLinkStorage = $this->prophesize(EntityStorageInterface::class);
$container = new ContainerBuilder();
$container->set('migrate.lookup', $this->migrateLookup->reveal());
\Drupal::setContainer($container);
}
/**
* @covers ::transform
*/
public function testTransformException() {
$plugin = new MenuLinkParent([], 'map', [], $this->migrateLookup->reveal(), $this->menuLinkManager->reveal(), $this->menuLinkStorage->reveal(), $this->migration->reveal());
$this->expectException(MigrateSkipRowException::class);
$this->expectExceptionMessage("No parent link found for plid '1' in menu 'admin'.");
$this->plugin->transform([1, 'admin', NULL], $this->migrateExecutable, $this->row, 'destinationproperty');
$plugin->transform([1, 'admin', NULL], $this->migrateExecutable, $this->row, 'destinationproperty');
}
/**
@ -44,6 +81,31 @@ class MenuLinkParentTest extends MigrateProcessTestCase {
* @covers ::transform
*/
public function testTransformExternal() {
$menu_link_content = $this->prophesize(MenuLinkContentInterface::class);
$menu_link_content->getPluginId()->willReturn('menu_link_content:fe151460-dfa2-4133-8864-c1746f28ab27');
$this->menuLinkStorage->loadByProperties([
'link__uri' => 'http://example.com',
])->willReturn([
9054 => $menu_link_content,
]);
$plugin = $this->prophesize(PluginInspectionInterface::class);
$this->menuLinkManager->createInstance('menu_link_content:fe151460-dfa2-4133-8864-c1746f28ab27')->willReturn($plugin->reveal());
$plugin = new MenuLinkParent([], 'map', [], $this->migrateLookup->reveal(), $this->menuLinkManager->reveal(), $this->menuLinkStorage->reveal(), $this->migration->reveal());
$result = $plugin->transform([1, 'admin', 'http://example.com'], $this->migrateExecutable, $this->row, 'destinationproperty');
$this->assertEquals('menu_link_content:fe151460-dfa2-4133-8864-c1746f28ab27', $result);
}
/**
* Tests the plugin when the parent is an external link.
*
* @covers ::transform
*
* @group legacy
*
* @expectedDeprecation Passing a migration process plugin as the fourth argument to Drupal\migrate\Plugin\migrate\process\MenuLinkParent::__construct is deprecated in drupal:8.8.0 and will throw an error in drupal:9.0.0. Pass the migrate.lookup service instead. See https://www.drupal.org/node/3047268
*/
public function testLegacyTransformExternal() {
$migration_plugin = $this->prophesize(MigrateProcessInterface::class);
$menu_link_manager = $this->prophesize(MenuLinkManagerInterface::class);
$menu_link_storage = $this->prophesize(EntityStorageInterface::class);

View File

@ -246,7 +246,7 @@ class FieldDiscoveryTest extends MigrateDrupal6TestBase {
'method' => 'process',
],
2 => [
'plugin' => 'migration',
'plugin' => 'migration_lookup',
'migration' => [
0 => 'd6_filter_format',
1 => 'd7_filter_format',

View File

@ -80,7 +80,7 @@ class TextField extends FieldPluginBase {
'method' => 'process',
],
[
'plugin' => 'migration',
'plugin' => 'migration_lookup',
'migration' => [
'd6_filter_format',
'd7_filter_format',

View File

@ -66,7 +66,7 @@ class TextFieldTest extends UnitTestCase {
// Ensure that filter format IDs will be looked up in the filter format
// migrations.
$lookup = $process['process']['format'][2];
$this->assertSame('migration', $lookup['plugin']);
$this->assertSame('migration_lookup', $lookup['plugin']);
$this->assertContains('d6_filter_format', $lookup['migration']);
$this->assertContains('d7_filter_format', $lookup['migration']);
$this->assertSame('format', $lookup['source']);
@ -89,7 +89,7 @@ class TextFieldTest extends UnitTestCase {
// Ensure that filter format IDs will be looked up in the filter format
// migrations.
$lookup = $process['process']['format'][2];
$this->assertSame('migration', $lookup['plugin']);
$this->assertSame('migration_lookup', $lookup['plugin']);
$this->assertContains('d6_filter_format', $lookup['migration']);
$this->assertContains('d7_filter_format', $lookup['migration']);
$this->assertSame('format', $lookup['source']);

View File

@ -61,7 +61,7 @@ class TextFieldTest extends UnitTestCase {
// Ensure that filter format IDs will be looked up in the filter format
// migrations.
$lookup = $process['process']['format'][2];
$this->assertSame('migration', $lookup['plugin']);
$this->assertSame('migration_lookup', $lookup['plugin']);
$this->assertContains('d6_filter_format', $lookup['migration']);
$this->assertContains('d7_filter_format', $lookup['migration']);
$this->assertSame('format', $lookup['source']);

View File

@ -122,7 +122,6 @@ trait DeprecationListenerTrait {
'MigrateCckFieldPluginManager is deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.x. Use \Drupal\migrate_drupal\Annotation\MigrateFieldPluginManager instead.',
'MigrateCckFieldPluginManagerInterface is deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.x. Use \Drupal\migrate_drupal\Annotation\MigrateFieldPluginManagerInterface instead.',
'The "plugin.manager.migrate.cckfield" service is deprecated. You should use the \'plugin.manager.migrate.field\' service instead. See https://www.drupal.org/node/2751897',
'The Drupal\migrate\Plugin\migrate\process\Migration is deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. Instead, use Drupal\migrate\Plugin\migrate\process\MigrationLookup',
'Passing in arguments the legacy way is deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. Provide the right parameter names in the method, similar to controllers. See https://www.drupal.org/node/2894819',
'The "serializer.normalizer.file_entity.hal" normalizer service is deprecated: it is obsolete, it only remains available for backwards compatibility.',
'The Symfony\Component\ClassLoader\ApcClassLoader class is deprecated since Symfony 3.3 and will be removed in 4.0. Use `composer install --apcu-autoloader` instead.',