updated core and modules
This commit is contained in:
@@ -7,8 +7,8 @@ package: Core (Experimental)
|
||||
dependencies:
|
||||
- migrate
|
||||
|
||||
# Information added by Drupal.org packaging script on 2016-08-03
|
||||
version: '8.1.8'
|
||||
# Information added by Drupal.org packaging script on 2017-08-16
|
||||
version: '8.3.7'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1470233792
|
||||
datestamp: 1502903957
|
||||
|
||||
@@ -20,7 +20,7 @@ function migrate_drupal_help($route_name, RouteMatchInterface $route_match) {
|
||||
case 'help.page.migrate_drupal':
|
||||
$output = '';
|
||||
$output .= '<h3>' . t('About') . '</h3>';
|
||||
$output .= '<p>' . t('The Migrate Drupal module provides a framework based on the <a href=":migrate">Migrate module</a> to facilitate migration from a Drupal (6, 7, or 8) site to your website. It does not provide a user interface. For more information, see the <a href=":migrate_drupal">online documentation for the Migrate Drupal module</a>.', array(':migrate' => \Drupal::url('help.page', array('name' => 'migrate')), ':migrate_drupal' => 'https://www.drupal.org/documentation/modules/migrate_drupal')) . '</p>';
|
||||
$output .= '<p>' . t('The Migrate Drupal module provides a framework based on the <a href=":migrate">Migrate module</a> to facilitate migration from a Drupal (6, 7, or 8) site to your website. It does not provide a user interface. For more information, see the <a href=":migrate_drupal">online documentation for the Migrate Drupal module</a>.', [':migrate' => \Drupal::url('help.page', ['name' => 'migrate']), ':migrate_drupal' => 'https://www.drupal.org/documentation/modules/migrate_drupal']) . '</p>';
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
services:
|
||||
plugin.manager.migrate.field:
|
||||
class: Drupal\migrate_drupal\Plugin\MigrateFieldPluginManager
|
||||
arguments:
|
||||
- field
|
||||
- '@container.namespaces'
|
||||
- '@cache.discovery'
|
||||
- '@module_handler'
|
||||
- '\Drupal\migrate_drupal\Annotation\MigrateField'
|
||||
plugin.manager.migrate.cckfield:
|
||||
class: Drupal\migrate_drupal\Plugin\MigrateCckFieldPluginManager
|
||||
arguments:
|
||||
@@ -7,3 +15,4 @@ services:
|
||||
- '@cache.discovery'
|
||||
- '@module_handler'
|
||||
- '\Drupal\migrate_drupal\Annotation\MigrateCckField'
|
||||
deprecated: The "%service_id%" service is deprecated. You should use the 'plugin.manager.migrate.field' service instead. See https://www.drupal.org/node/2751897
|
||||
|
||||
@@ -2,53 +2,20 @@
|
||||
|
||||
namespace Drupal\migrate_drupal\Annotation;
|
||||
|
||||
use Drupal\Component\Annotation\Plugin;
|
||||
@trigger_error('MigrateCckField is deprecated in Drupal 8.3.x and will be
|
||||
removed before Drupal 9.0.x. Use \Drupal\migrate_drupal\Annotation\MigrateField
|
||||
instead.', E_USER_DEPRECATED);
|
||||
|
||||
/**
|
||||
* Defines a cckfield plugin annotation object.
|
||||
* Deprecated: Defines a cckfield plugin annotation object.
|
||||
*
|
||||
* cckfield plugins are variously responsible for handling the migration of
|
||||
* CCK fields from Drupal 6 to Drupal 8, and Field API fields from Drupal 7
|
||||
* to Drupal 8. They are allowed to alter CCK-related migrations when migrations
|
||||
* are being generated, and can compute destination field types for individual
|
||||
* fields during the actual migration process.
|
||||
* @deprecated in Drupal 8.3.x, to be removed before Drupal 9.0.x. Use
|
||||
* \Drupal\migrate_drupal\Annotation\MigrateField instead.
|
||||
*
|
||||
* Plugin Namespace: Plugin\migrate\cckfield
|
||||
*
|
||||
* @Annotation
|
||||
*/
|
||||
class MigrateCckField extends Plugin {
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function __construct($values) {
|
||||
parent::__construct($values);
|
||||
// Provide default value for core property, in case it's missing.
|
||||
if (empty($this->definition['core'])) {
|
||||
$this->definition['core'] = [6];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The plugin ID.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* Map of D6 and D7 field types to D8 field type plugin IDs.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
public $type_map = [];
|
||||
|
||||
/**
|
||||
* The Drupal core version(s) this plugin applies to.
|
||||
*
|
||||
* @var int[]
|
||||
*/
|
||||
public $core = [];
|
||||
class MigrateCckField extends MigrateField {
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\migrate_drupal\Annotation;
|
||||
|
||||
use Drupal\Component\Annotation\Plugin;
|
||||
|
||||
/**
|
||||
* Defines a field plugin annotation object.
|
||||
*
|
||||
* Field plugins are responsible for handling the migration of custom fields
|
||||
* (provided by CCK in Drupal 6 and Field API in Drupal 7) to Drupal 8. They are
|
||||
* allowed to alter fieldable entity migrations when these migrations are being
|
||||
* generated, and can compute destination field types for individual fields
|
||||
* during the actual migration process.
|
||||
*
|
||||
* Plugin Namespace: Plugin\migrate\field
|
||||
*
|
||||
* @Annotation
|
||||
*/
|
||||
class MigrateField extends Plugin {
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function __construct($values) {
|
||||
parent::__construct($values);
|
||||
// Provide default value for core property, in case it's missing.
|
||||
if (empty($this->definition['core'])) {
|
||||
$this->definition['core'] = [6];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The plugin ID.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* Map of D6 and D7 field types to D8 field type plugin IDs.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
public $type_map = [];
|
||||
|
||||
/**
|
||||
* The Drupal core version(s) this plugin applies to.
|
||||
*
|
||||
* @var int[]
|
||||
*/
|
||||
public $core = [];
|
||||
|
||||
}
|
||||
@@ -125,7 +125,7 @@ trait MigrationConfigurationTrait {
|
||||
* @param \Drupal\Core\Database\Connection $connection
|
||||
* The database connection object.
|
||||
*
|
||||
* @return int|FALSE
|
||||
* @return int|false
|
||||
* An integer representing the major branch of Drupal core (e.g. '6' for
|
||||
* Drupal 6.x), or FALSE if no valid version is matched.
|
||||
*/
|
||||
|
||||
@@ -2,64 +2,19 @@
|
||||
|
||||
namespace Drupal\migrate_drupal\Plugin;
|
||||
|
||||
use Drupal\Component\Plugin\PluginInspectionInterface;
|
||||
@trigger_error('MigrateCckFieldInterface is deprecated in Drupal 8.3.x and will
|
||||
be removed before Drupal 9.0.x. Use \Drupal\migrate_drupal\Annotation\MigrateField
|
||||
instead.', E_USER_DEPRECATED);
|
||||
|
||||
use Drupal\migrate\Plugin\MigrationInterface;
|
||||
use Drupal\migrate\Row;
|
||||
|
||||
/**
|
||||
* Provides an interface for all CCK field type plugins.
|
||||
*
|
||||
* @deprecated in Drupal 8.3.x, to be removed before Drupal 9.0.x. Use
|
||||
* \Drupal\migrate_drupal\Annotation\MigrateField instead.
|
||||
*/
|
||||
interface MigrateCckFieldInterface extends PluginInspectionInterface {
|
||||
|
||||
/**
|
||||
* Apply any custom processing to the field migration.
|
||||
*
|
||||
* @param \Drupal\migrate\Plugin\MigrationInterface $migration
|
||||
* The migration entity.
|
||||
*/
|
||||
public function processField(MigrationInterface $migration);
|
||||
|
||||
/**
|
||||
* Apply any custom processing to the field instance migration.
|
||||
*
|
||||
* @param \Drupal\migrate\Plugin\MigrationInterface $migration
|
||||
* The migration entity.
|
||||
*/
|
||||
public function processFieldInstance(MigrationInterface $migration);
|
||||
|
||||
/**
|
||||
* Apply any custom processing to the field widget migration.
|
||||
*
|
||||
* @param \Drupal\migrate\Plugin\MigrationInterface $migration
|
||||
* The migration entity.
|
||||
*/
|
||||
public function processFieldWidget(MigrationInterface $migration);
|
||||
|
||||
/**
|
||||
* Apply any custom processing to the field formatter migration.
|
||||
*
|
||||
* @param \Drupal\migrate\Plugin\MigrationInterface $migration
|
||||
* The migration entity.
|
||||
*/
|
||||
public function processFieldFormatter(MigrationInterface $migration);
|
||||
|
||||
/**
|
||||
* Get a map between D6 formatters and D8 formatters for this field type.
|
||||
*
|
||||
* This is used by static::processFieldFormatter() in the base class.
|
||||
*
|
||||
* @return array
|
||||
* The keys are D6 formatters and the values are D8 formatters.
|
||||
*/
|
||||
public function getFieldFormatterMap();
|
||||
|
||||
/**
|
||||
* Get a map between D6 and D8 widgets for this field type.
|
||||
*
|
||||
* @return array
|
||||
* The keys are D6 field widget types and the values D8 widgets.
|
||||
*/
|
||||
public function getFieldWidgetMap();
|
||||
interface MigrateCckFieldInterface extends MigrateFieldInterface {
|
||||
|
||||
/**
|
||||
* Apply any custom processing to the cck bundle migrations.
|
||||
@@ -73,15 +28,4 @@ interface MigrateCckFieldInterface extends PluginInspectionInterface {
|
||||
*/
|
||||
public function processCckFieldValues(MigrationInterface $migration, $field_name, $data);
|
||||
|
||||
/**
|
||||
* Computes the destination type of a migrated field.
|
||||
*
|
||||
* @param \Drupal\migrate\Row $row
|
||||
* The field being migrated.
|
||||
*
|
||||
* @return string
|
||||
* The destination field type.
|
||||
*/
|
||||
public function getFieldType(Row $row);
|
||||
|
||||
}
|
||||
|
||||
@@ -2,54 +2,16 @@
|
||||
|
||||
namespace Drupal\migrate_drupal\Plugin;
|
||||
|
||||
use Drupal\Component\Plugin\Exception\PluginNotFoundException;
|
||||
use Drupal\migrate\Plugin\MigratePluginManager;
|
||||
use Drupal\migrate\Plugin\MigrationInterface;
|
||||
@trigger_error('MigrateCckFieldPluginManager is deprecated in Drupal 8.3.x and will
|
||||
be removed before Drupal 9.0.x. Use \Drupal\migrate_drupal\Annotation\MigrateFieldPluginManager
|
||||
instead.', E_USER_DEPRECATED);
|
||||
|
||||
/**
|
||||
* Plugin manager for migrate cckfield plugins.
|
||||
* Deprecated: Plugin manager for migrate field plugins.
|
||||
*
|
||||
* @see \Drupal\migrate_drupal\Plugin\MigrateCckFieldInterface
|
||||
* @see \Drupal\migrate\Annotation\MigrateCckField
|
||||
* @see plugin_api
|
||||
* @deprecated in Drupal 8.3.x, to be removed before Drupal 9.0.x. Use
|
||||
* \Drupal\migrate_drupal\Plugin\MigrateFieldPluginManager instead.
|
||||
*
|
||||
* @ingroup migration
|
||||
*/
|
||||
class MigrateCckFieldPluginManager extends MigratePluginManager {
|
||||
|
||||
/**
|
||||
* The default version of core to use for cck field plugins.
|
||||
*
|
||||
* These plugins were initially only built and used for Drupal 6 fields.
|
||||
* Having been extended for Drupal 7 with a "core" annotation, we fall back to
|
||||
* Drupal 6 where none exists.
|
||||
*/
|
||||
const DEFAULT_CORE_VERSION = 6;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createInstance($field_type, array $configuration = array(), MigrationInterface $migration = NULL) {
|
||||
$core = static::DEFAULT_CORE_VERSION;
|
||||
if (!empty($configuration['core'])) {
|
||||
$core = $configuration['core'];
|
||||
}
|
||||
elseif (!empty($migration->getPluginDefinition()['migration_tags'])) {
|
||||
foreach ($migration->getPluginDefinition()['migration_tags'] as $tag) {
|
||||
if ($tag == 'Drupal 7') {
|
||||
$core = 7;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($this->getDefinitions() as $plugin_id => $definition) {
|
||||
if (in_array($core, $definition['core'])) {
|
||||
if (array_key_exists($field_type, $definition['type_map']) || $field_type === $plugin_id) {
|
||||
return parent::createInstance($plugin_id, $configuration, $migration);
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new PluginNotFoundException($field_type);
|
||||
}
|
||||
|
||||
}
|
||||
class MigrateCckFieldPluginManager extends MigrateFieldPluginManager implements MigrateCckFieldPluginManagerInterface { }
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\migrate_drupal\Plugin;
|
||||
|
||||
@trigger_error('MigrateCckFieldPluginManagerInterface is deprecated in Drupal 8.3.x
|
||||
and will be removed before Drupal 9.0.x. Use \Drupal\migrate_drupal\Annotation\MigrateFieldPluginManagerInterface
|
||||
instead.', E_USER_DEPRECATED);
|
||||
|
||||
/**
|
||||
* Provides an interface for cck field plugin manager.
|
||||
*
|
||||
* @deprecated in Drupal 8.3.x, to be removed before Drupal 9.0.x. Use
|
||||
* \Drupal\migrate_drupal\Plugin\MigrateFieldPluginManagerInterface instead.
|
||||
*
|
||||
* @see https://www.drupal.org/node/2751897
|
||||
*/
|
||||
interface MigrateCckFieldPluginManagerInterface extends MigrateFieldPluginManagerInterface { }
|
||||
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\migrate_drupal\Plugin;
|
||||
|
||||
use Drupal\Component\Plugin\PluginInspectionInterface;
|
||||
use Drupal\migrate\Plugin\MigrationInterface;
|
||||
use Drupal\migrate\Row;
|
||||
|
||||
/**
|
||||
* Provides an interface for all field type plugins.
|
||||
*/
|
||||
interface MigrateFieldInterface extends PluginInspectionInterface {
|
||||
|
||||
/**
|
||||
* Apply any custom processing to the field migration.
|
||||
*
|
||||
* @param \Drupal\migrate\Plugin\MigrationInterface $migration
|
||||
* The migration entity.
|
||||
*/
|
||||
public function processField(MigrationInterface $migration);
|
||||
|
||||
/**
|
||||
* Apply any custom processing to the field instance migration.
|
||||
*
|
||||
* @param \Drupal\migrate\Plugin\MigrationInterface $migration
|
||||
* The migration entity.
|
||||
*/
|
||||
public function processFieldInstance(MigrationInterface $migration);
|
||||
|
||||
/**
|
||||
* Apply any custom processing to the field widget migration.
|
||||
*
|
||||
* @param \Drupal\migrate\Plugin\MigrationInterface $migration
|
||||
* The migration entity.
|
||||
*/
|
||||
public function processFieldWidget(MigrationInterface $migration);
|
||||
|
||||
/**
|
||||
* Apply any custom processing to the field formatter migration.
|
||||
*
|
||||
* @param \Drupal\migrate\Plugin\MigrationInterface $migration
|
||||
* The migration entity.
|
||||
*/
|
||||
public function processFieldFormatter(MigrationInterface $migration);
|
||||
|
||||
/**
|
||||
* Get a map between D6 formatters and D8 formatters for this field type.
|
||||
*
|
||||
* This is used by static::processFieldFormatter() in the base class.
|
||||
*
|
||||
* @return array
|
||||
* The keys are D6 formatters and the values are D8 formatters.
|
||||
*/
|
||||
public function getFieldFormatterMap();
|
||||
|
||||
/**
|
||||
* Get a map between D6 and D8 widgets for this field type.
|
||||
*
|
||||
* @return array
|
||||
* The keys are D6 field widget types and the values D8 widgets.
|
||||
*/
|
||||
public function getFieldWidgetMap();
|
||||
|
||||
/**
|
||||
* Apply any custom processing to the field bundle migrations.
|
||||
*
|
||||
* @param \Drupal\migrate\Plugin\MigrationInterface $migration
|
||||
* The migration entity.
|
||||
* @param string $field_name
|
||||
* The field name we're processing the value for.
|
||||
* @param array $data
|
||||
* The array of field data from FieldValues::fieldData().
|
||||
*/
|
||||
public function processFieldValues(MigrationInterface $migration, $field_name, $data);
|
||||
|
||||
/**
|
||||
* Computes the destination type of a migrated field.
|
||||
*
|
||||
* @param \Drupal\migrate\Row $row
|
||||
* The field being migrated.
|
||||
*
|
||||
* @return string
|
||||
* The destination field type.
|
||||
*/
|
||||
public function getFieldType(Row $row);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\migrate_drupal\Plugin;
|
||||
|
||||
use Drupal\Component\Plugin\Exception\PluginNotFoundException;
|
||||
use Drupal\migrate\Plugin\MigratePluginManager;
|
||||
use Drupal\migrate\Plugin\MigrationInterface;
|
||||
|
||||
/**
|
||||
* Plugin manager for migrate cckfield plugins.
|
||||
*
|
||||
* @see \Drupal\migrate_drupal\Plugin\MigrateFieldInterface
|
||||
* @see \Drupal\migrate\Annotation\MigrateField
|
||||
* @see plugin_api
|
||||
*
|
||||
* @ingroup migration
|
||||
*/
|
||||
class MigrateFieldPluginManager extends MigratePluginManager implements MigrateFieldPluginManagerInterface {
|
||||
|
||||
/**
|
||||
* The default version of core to use for field plugins.
|
||||
*
|
||||
* These plugins were initially only built and used for Drupal 6 fields.
|
||||
* Having been extended for Drupal 7 with a "core" annotation, we fall back to
|
||||
* Drupal 6 where none exists.
|
||||
*/
|
||||
const DEFAULT_CORE_VERSION = 6;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getPluginIdFromFieldType($field_type, array $configuration = [], MigrationInterface $migration = NULL) {
|
||||
$core = static::DEFAULT_CORE_VERSION;
|
||||
if (!empty($configuration['core'])) {
|
||||
$core = $configuration['core'];
|
||||
}
|
||||
elseif (!empty($migration->getPluginDefinition()['migration_tags'])) {
|
||||
foreach ($migration->getPluginDefinition()['migration_tags'] as $tag) {
|
||||
if ($tag == 'Drupal 7') {
|
||||
$core = 7;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$definitions = $this->getDefinitions();
|
||||
foreach ($definitions as $plugin_id => $definition) {
|
||||
if (in_array($core, $definition['core'])) {
|
||||
if (array_key_exists($field_type, $definition['type_map']) || $field_type === $plugin_id) {
|
||||
return $plugin_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new PluginNotFoundException($field_type);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\migrate_drupal\Plugin;
|
||||
|
||||
use Drupal\migrate\Plugin\MigratePluginManagerInterface;
|
||||
use Drupal\migrate\Plugin\MigrationInterface;
|
||||
|
||||
interface MigrateFieldPluginManagerInterface extends MigratePluginManagerInterface {
|
||||
|
||||
/**
|
||||
* Get the plugin ID from the field type.
|
||||
*
|
||||
* @param string $field_type
|
||||
* The field type being migrated.
|
||||
* @param array $configuration
|
||||
* (optional) An array of configuration relevant to the plugin instance.
|
||||
* @param \Drupal\migrate\Plugin\MigrationInterface|null $migration
|
||||
* (optional) The current migration instance.
|
||||
*
|
||||
* @return string
|
||||
* The ID of the plugin for the field_type if available.
|
||||
*
|
||||
* @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException
|
||||
* If the plugin cannot be determined, such as if the field type is invalid.
|
||||
*/
|
||||
public function getPluginIdFromFieldType($field_type, array $configuration = [], MigrationInterface $migration = NULL);
|
||||
|
||||
}
|
||||
@@ -2,122 +2,21 @@
|
||||
|
||||
namespace Drupal\migrate_drupal\Plugin\migrate;
|
||||
|
||||
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
|
||||
use Drupal\migrate\Exception\RequirementsException;
|
||||
use Drupal\migrate\Plugin\MigrateDestinationPluginManager;
|
||||
use Drupal\migrate\Plugin\MigratePluginManager;
|
||||
use Drupal\migrate\Plugin\Migration;
|
||||
use Drupal\migrate\Plugin\MigrationPluginManagerInterface;
|
||||
use Drupal\migrate\Plugin\RequirementsInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
@trigger_error('CckMigration is deprecated in Drupal 8.3.x and will be removed
|
||||
before Drupal 9.0.x. Use \Drupal\migrate_drupal\Plugin\migrate\FieldMigration
|
||||
instead.', E_USER_DEPRECATED);
|
||||
|
||||
/**
|
||||
* Migration plugin class for migrations dealing with CCK field values.
|
||||
*
|
||||
* @deprecated in Drupal 8.3.x, to be removed before Drupal 9.0.x. Use
|
||||
* \Drupal\migrate_drupal\Plugin\migrate\FieldMigration instead.
|
||||
*/
|
||||
class CckMigration extends Migration implements ContainerFactoryPluginInterface {
|
||||
|
||||
/**
|
||||
* Flag indicating whether the CCK data has been filled already.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $init = FALSE;
|
||||
|
||||
/**
|
||||
* List of cckfield plugin IDs which have already run.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected $processedFieldTypes = [];
|
||||
|
||||
/**
|
||||
* Already-instantiated cckfield plugins, keyed by ID.
|
||||
*
|
||||
* @var \Drupal\migrate_drupal\Plugin\MigrateCckFieldInterface[]
|
||||
*/
|
||||
protected $cckPluginCache;
|
||||
|
||||
/**
|
||||
* The cckfield plugin manager.
|
||||
*
|
||||
* @var \Drupal\migrate\Plugin\MigratePluginManager
|
||||
*/
|
||||
protected $cckPluginManager;
|
||||
|
||||
/**
|
||||
* Constructs a CckMigration.
|
||||
*
|
||||
* @param array $configuration
|
||||
* Plugin configuration.
|
||||
* @param string $plugin_id
|
||||
* The plugin ID.
|
||||
* @param mixed $plugin_definition
|
||||
* The plugin definition.
|
||||
* @param \Drupal\migrate\Plugin\MigratePluginManager $cck_manager
|
||||
* The cckfield plugin manager.
|
||||
* @param \Drupal\migrate\Plugin\MigrationPluginManagerInterface $migration_plugin_manager
|
||||
* The migration plugin manager.
|
||||
* @param \Drupal\migrate\Plugin\MigratePluginManager $source_plugin_manager
|
||||
* The source migration plugin manager.
|
||||
* @param \Drupal\migrate\Plugin\MigratePluginManager $process_plugin_manager
|
||||
* The process migration plugin manager.
|
||||
* @param \Drupal\migrate\Plugin\MigrateDestinationPluginManager $destination_plugin_manager
|
||||
* The destination migration plugin manager.
|
||||
* @param \Drupal\migrate\Plugin\MigratePluginManager $idmap_plugin_manager
|
||||
* The ID map migration plugin manager.
|
||||
*/
|
||||
public function __construct(array $configuration, $plugin_id, $plugin_definition, MigratePluginManager $cck_manager, MigrationPluginManagerInterface $migration_plugin_manager, MigratePluginManager $source_plugin_manager, MigratePluginManager $process_plugin_manager, MigrateDestinationPluginManager $destination_plugin_manager, MigratePluginManager $idmap_plugin_manager) {
|
||||
parent::__construct($configuration, $plugin_id, $plugin_definition, $migration_plugin_manager, $source_plugin_manager, $process_plugin_manager, $destination_plugin_manager, $idmap_plugin_manager);
|
||||
$this->cckPluginManager = $cck_manager;
|
||||
}
|
||||
class CckMigration extends FieldMigration {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
|
||||
return new static(
|
||||
$configuration,
|
||||
$plugin_id,
|
||||
$plugin_definition,
|
||||
$container->get('plugin.manager.migrate.cckfield'),
|
||||
$container->get('plugin.manager.migration'),
|
||||
$container->get('plugin.manager.migrate.source'),
|
||||
$container->get('plugin.manager.migrate.process'),
|
||||
$container->get('plugin.manager.migrate.destination'),
|
||||
$container->get('plugin.manager.migrate.id_map')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getProcess() {
|
||||
if (!$this->init) {
|
||||
$this->init = TRUE;
|
||||
$source_plugin = $this->migrationPluginManager->createInstance($this->pluginId)->getSourcePlugin();
|
||||
if ($source_plugin instanceof RequirementsInterface) {
|
||||
try {
|
||||
$source_plugin->checkRequirements();
|
||||
}
|
||||
catch (RequirementsException $e) {
|
||||
// Kill the rest of the method.
|
||||
$source_plugin = [];
|
||||
}
|
||||
}
|
||||
foreach ($source_plugin as $row) {
|
||||
$field_type = $row->getSourceProperty('type');
|
||||
if (!isset($this->processedFieldTypes[$field_type]) && $this->cckPluginManager->hasDefinition($field_type)) {
|
||||
$this->processedFieldTypes[$field_type] = TRUE;
|
||||
// Allow the cckfield plugin to alter the migration as necessary so
|
||||
// that it knows how to handle fields of this type.
|
||||
if (!isset($this->cckPluginCache[$field_type])) {
|
||||
$this->cckPluginCache[$field_type] = $this->cckPluginManager->createInstance($field_type, [], $this);
|
||||
}
|
||||
call_user_func([$this->cckPluginCache[$field_type], $this->pluginDefinition['cck_plugin_method']], $this);
|
||||
}
|
||||
}
|
||||
}
|
||||
return parent::getProcess();
|
||||
}
|
||||
const PLUGIN_METHOD = 'cck_plugin_method';
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,171 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\migrate_drupal\Plugin\migrate;
|
||||
|
||||
use Drupal\Component\Plugin\Exception\PluginNotFoundException;
|
||||
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
|
||||
use Drupal\migrate\Exception\RequirementsException;
|
||||
use Drupal\migrate\Plugin\MigrateDestinationPluginManager;
|
||||
use Drupal\migrate\Plugin\MigratePluginManager;
|
||||
use Drupal\migrate\Plugin\Migration;
|
||||
use Drupal\migrate\Plugin\MigrationPluginManagerInterface;
|
||||
use Drupal\migrate\Plugin\RequirementsInterface;
|
||||
use Drupal\migrate_drupal\Plugin\MigrateCckFieldPluginManagerInterface;
|
||||
use Drupal\migrate_drupal\Plugin\MigrateFieldPluginManagerInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
/**
|
||||
* Migration plugin class for migrations dealing with field config and values.
|
||||
*/
|
||||
class FieldMigration extends Migration implements ContainerFactoryPluginInterface {
|
||||
|
||||
/**
|
||||
* Defines which configuration option has the migration processing function.
|
||||
*
|
||||
* Default method is 'field_plugin_method'. For backwards compatibility,
|
||||
* this constant is overridden in the CckMigration class, in order to
|
||||
* fallback to the old 'cck_plugin_method'.
|
||||
*
|
||||
* @const string
|
||||
*/
|
||||
const PLUGIN_METHOD = 'field_plugin_method';
|
||||
|
||||
/**
|
||||
* Flag indicating whether the field data has been filled already.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $init = FALSE;
|
||||
|
||||
/**
|
||||
* List of field plugin IDs which have already run.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected $processedFieldTypes = [];
|
||||
|
||||
/**
|
||||
* Already-instantiated field plugins, keyed by ID.
|
||||
*
|
||||
* @var \Drupal\migrate_drupal\Plugin\MigrateFieldInterface[]
|
||||
*/
|
||||
protected $fieldPluginCache;
|
||||
|
||||
/**
|
||||
* The field plugin manager.
|
||||
*
|
||||
* @var \Drupal\migrate_drupal\Plugin\MigrateFieldPluginManagerInterface
|
||||
*/
|
||||
protected $fieldPluginManager;
|
||||
|
||||
/**
|
||||
* Already-instantiated cckfield plugins, keyed by ID.
|
||||
*
|
||||
* @var \Drupal\migrate_drupal\Plugin\MigrateCckFieldInterface[]
|
||||
*/
|
||||
protected $cckPluginCache;
|
||||
|
||||
/**
|
||||
* The cckfield plugin manager.
|
||||
*
|
||||
* @var \Drupal\migrate_drupal\Plugin\MigrateCckFieldPluginManagerInterface
|
||||
*/
|
||||
protected $cckPluginManager;
|
||||
|
||||
/**
|
||||
* Constructs a FieldMigration.
|
||||
*
|
||||
* @param array $configuration
|
||||
* Plugin configuration.
|
||||
* @param string $plugin_id
|
||||
* The plugin ID.
|
||||
* @param mixed $plugin_definition
|
||||
* The plugin definition.
|
||||
* @param \Drupal\migrate_drupal\Plugin\MigrateCckFieldPluginManagerInterface $cck_manager
|
||||
* The cckfield plugin manager.
|
||||
* @param \Drupal\migrate_drupal\Plugin\MigrateFieldPluginManagerInterface $field_manager
|
||||
* The field plugin manager.
|
||||
* @param \Drupal\migrate\Plugin\MigrationPluginManagerInterface $migration_plugin_manager
|
||||
* The migration plugin manager.
|
||||
* @param \Drupal\migrate\Plugin\MigratePluginManager $source_plugin_manager
|
||||
* The source migration plugin manager.
|
||||
* @param \Drupal\migrate\Plugin\MigratePluginManager $process_plugin_manager
|
||||
* The process migration plugin manager.
|
||||
* @param \Drupal\migrate\Plugin\MigrateDestinationPluginManager $destination_plugin_manager
|
||||
* The destination migration plugin manager.
|
||||
* @param \Drupal\migrate\Plugin\MigratePluginManager $idmap_plugin_manager
|
||||
* The ID map migration plugin manager.
|
||||
*/
|
||||
public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrateCckFieldPluginManagerInterface $cck_manager, MigrateFieldPluginManagerInterface $field_manager, MigrationPluginManagerInterface $migration_plugin_manager, MigratePluginManager $source_plugin_manager, MigratePluginManager $process_plugin_manager, MigrateDestinationPluginManager $destination_plugin_manager, MigratePluginManager $idmap_plugin_manager) {
|
||||
parent::__construct($configuration, $plugin_id, $plugin_definition, $migration_plugin_manager, $source_plugin_manager, $process_plugin_manager, $destination_plugin_manager, $idmap_plugin_manager);
|
||||
$this->cckPluginManager = $cck_manager;
|
||||
$this->fieldPluginManager = $field_manager;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
|
||||
return new static(
|
||||
$configuration,
|
||||
$plugin_id,
|
||||
$plugin_definition,
|
||||
$container->get('plugin.manager.migrate.cckfield'),
|
||||
$container->get('plugin.manager.migrate.field'),
|
||||
$container->get('plugin.manager.migration'),
|
||||
$container->get('plugin.manager.migrate.source'),
|
||||
$container->get('plugin.manager.migrate.process'),
|
||||
$container->get('plugin.manager.migrate.destination'),
|
||||
$container->get('plugin.manager.migrate.id_map')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getProcess() {
|
||||
if (!$this->init) {
|
||||
$this->init = TRUE;
|
||||
$source_plugin = $this->migrationPluginManager->createInstance($this->pluginId)->getSourcePlugin();
|
||||
if ($source_plugin instanceof RequirementsInterface) {
|
||||
try {
|
||||
$source_plugin->checkRequirements();
|
||||
}
|
||||
catch (RequirementsException $e) {
|
||||
// Kill the rest of the method.
|
||||
$source_plugin = [];
|
||||
}
|
||||
}
|
||||
foreach ($source_plugin as $row) {
|
||||
$field_type = $row->getSourceProperty('type');
|
||||
|
||||
try {
|
||||
$plugin_id = $this->cckPluginManager->getPluginIdFromFieldType($field_type, [], $this);
|
||||
$Manager = $this->cckPluginManager;
|
||||
}
|
||||
catch (PluginNotFoundException $ex) {
|
||||
try {
|
||||
$plugin_id = $this->fieldPluginManager->getPluginIdFromFieldType($field_type, [], $this);
|
||||
$Manager = $this->fieldPluginManager;
|
||||
}
|
||||
catch (PluginNotFoundException $ex) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($this->processedFieldTypes[$field_type]) && $Manager->hasDefinition($plugin_id)) {
|
||||
$this->processedFieldTypes[$field_type] = TRUE;
|
||||
// Allow the field plugin to alter the migration as necessary so that
|
||||
// it knows how to handle fields of this type.
|
||||
if (!isset($this->fieldPluginCache[$field_type])) {
|
||||
$this->fieldPluginCache[$field_type] = $Manager->createInstance($plugin_id, [], $this);
|
||||
}
|
||||
}
|
||||
$method = $this->pluginDefinition[static::PLUGIN_METHOD];
|
||||
call_user_func([$this->fieldPluginCache[$field_type], $method], $this);
|
||||
}
|
||||
}
|
||||
return parent::getProcess();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,82 +2,49 @@
|
||||
|
||||
namespace Drupal\migrate_drupal\Plugin\migrate\cckfield;
|
||||
|
||||
use Drupal\Core\Plugin\PluginBase;
|
||||
@trigger_error('CckFieldPluginBase is deprecated in Drupal 8.3.x and will be
|
||||
be removed before Drupal 9.0.x. Use \Drupal\migrate_drupal\Plugin\migrate\field\FieldPluginBase
|
||||
instead.', E_USER_DEPRECATED);
|
||||
|
||||
use Drupal\migrate\Plugin\MigrationInterface;
|
||||
use Drupal\migrate\Row;
|
||||
use Drupal\migrate_drupal\Plugin\MigrateCckFieldInterface;
|
||||
use Drupal\migrate_drupal\Plugin\migrate\field\FieldPluginBase;
|
||||
|
||||
/**
|
||||
* The base class for all cck field plugins.
|
||||
* The base class for all field plugins.
|
||||
*
|
||||
* @see \Drupal\migrate\Plugin\MigratePluginManager
|
||||
* @see \Drupal\migrate_drupal\Annotation\MigrateCckField
|
||||
* @see \Drupal\migrate_drupal\Plugin\MigrateCckFieldInterface
|
||||
* @see plugin_api
|
||||
* @deprecated in Drupal 8.3.x, to be removed before Drupal 9.0.x. Use
|
||||
* \Drupal\migrate_drupal\Plugin\migrate\field\FieldPluginBase instead.
|
||||
*
|
||||
* @ingroup migration
|
||||
*/
|
||||
abstract class CckFieldPluginBase extends PluginBase implements MigrateCckFieldInterface {
|
||||
abstract class CckFieldPluginBase extends FieldPluginBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* Apply any custom processing to the field bundle migrations.
|
||||
*
|
||||
* @param \Drupal\migrate\Plugin\MigrationInterface $migration
|
||||
* The migration entity.
|
||||
* @param string $field_name
|
||||
* The field name we're processing the value for.
|
||||
* @param array $data
|
||||
* The array of field data from FieldValues::fieldData().
|
||||
*/
|
||||
public function processField(MigrationInterface $migration) {
|
||||
$process[0]['map'][$this->pluginId][$this->pluginId] = $this->pluginId;
|
||||
$migration->mergeProcessOfProperty('type', $process);
|
||||
public function processFieldValues(MigrationInterface $migration, $field_name, $data) {
|
||||
// Provide a bridge to the old method declared on the interface and now an
|
||||
// abstract method in this class.
|
||||
return $this->processCckFieldValues($migration, $field_name, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* Apply any custom processing to the field bundle migrations.
|
||||
*
|
||||
* @param \Drupal\migrate\Plugin\MigrationInterface $migration
|
||||
* The migration entity.
|
||||
* @param string $field_name
|
||||
* The field name we're processing the value for.
|
||||
* @param array $data
|
||||
* The array of field data from FieldValues::fieldData().
|
||||
*/
|
||||
public function processFieldInstance(MigrationInterface $migration) {
|
||||
// Nothing to do by default with field instances.
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function processFieldWidget(MigrationInterface $migration) {
|
||||
$process = [];
|
||||
foreach ($this->getFieldWidgetMap() as $source_widget => $destination_widget) {
|
||||
$process['type']['map'][$source_widget] = $destination_widget;
|
||||
}
|
||||
$migration->mergeProcessOfProperty('options/type', $process);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFieldWidgetMap() {
|
||||
// By default, use the plugin ID for the widget types.
|
||||
return [
|
||||
$this->pluginId => $this->pluginId . '_default',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function processFieldFormatter(MigrationInterface $migration) {
|
||||
$process = [];
|
||||
foreach ($this->getFieldFormatterMap() as $source_format => $destination_format) {
|
||||
$process[0]['map'][$this->pluginId][$source_format] = $destination_format;
|
||||
}
|
||||
$migration->mergeProcessOfProperty('options/type', $process);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFieldType(Row $row) {
|
||||
$field_type = $row->getSourceProperty('type');
|
||||
|
||||
if (isset($this->pluginDefinition['type_map'][$field_type])) {
|
||||
return $this->pluginDefinition['type_map'][$field_type];
|
||||
}
|
||||
else {
|
||||
return $field_type;
|
||||
}
|
||||
}
|
||||
abstract public function processCckFieldValues(MigrationInterface $migration, $field_name, $data);
|
||||
|
||||
}
|
||||
|
||||
+19
-3
@@ -2,18 +2,26 @@
|
||||
|
||||
namespace Drupal\migrate_drupal\Plugin\migrate\destination;
|
||||
|
||||
use Drupal\Core\Config\ConfigFactoryInterface;
|
||||
use Drupal\Core\Entity\EntityStorageInterface;
|
||||
use Drupal\Core\Field\FieldTypePluginManagerInterface;
|
||||
use Drupal\Core\Language\LanguageManagerInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Drupal\migrate\Plugin\MigrationInterface;
|
||||
use Drupal\migrate\Plugin\migrate\destination\EntityFieldStorageConfig as BaseEntityFieldStorageConfig;
|
||||
|
||||
/**
|
||||
* Destination with Drupal specific config dependencies.
|
||||
* Deprecated. Destination with Drupal specific config dependencies.
|
||||
*
|
||||
* @MigrateDestination(
|
||||
* id = "md_entity:field_storage_config"
|
||||
* )
|
||||
*
|
||||
* @deprecated in Drupal 8.2.x and will be removed in Drupal 9.0.x. Use
|
||||
* \Drupal\migrate\Plugin\migrate\destination\EntityFieldStorageConfig
|
||||
* instead.
|
||||
*
|
||||
* @see \Drupal\migrate\Plugin\migrate\destination\EntityFieldStorageConfig
|
||||
*/
|
||||
class EntityFieldStorageConfig extends BaseEntityFieldStorageConfig {
|
||||
|
||||
@@ -39,11 +47,17 @@ class EntityFieldStorageConfig extends BaseEntityFieldStorageConfig {
|
||||
* The storage for this entity type.
|
||||
* @param array $bundles
|
||||
* The list of bundles this entity type has.
|
||||
* @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
|
||||
* The language manager.
|
||||
* @param \Drupal\Core\Field\FieldTypePluginManagerInterface $field_type_plugin_manager
|
||||
* The field type plugin manager.
|
||||
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
|
||||
* The configuration factory.
|
||||
*/
|
||||
public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, EntityStorageInterface $storage, array $bundles, FieldTypePluginManagerInterface $field_type_plugin_manager) {
|
||||
parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $storage, $bundles);
|
||||
public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, EntityStorageInterface $storage, array $bundles, LanguageManagerInterface $language_manager, ConfigFactoryInterface $config_factory, FieldTypePluginManagerInterface $field_type_plugin_manager) {
|
||||
parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $storage, $bundles, $language_manager, $config_factory, $field_type_plugin_manager);
|
||||
$this->languageManager = $language_manager;
|
||||
$this->configFactory = $config_factory;
|
||||
$this->fieldTypePluginManager = $field_type_plugin_manager;
|
||||
}
|
||||
|
||||
@@ -59,6 +73,8 @@ class EntityFieldStorageConfig extends BaseEntityFieldStorageConfig {
|
||||
$migration,
|
||||
$container->get('entity.manager')->getStorage($entity_type_id),
|
||||
array_keys($container->get('entity.manager')->getBundleInfo($entity_type_id)),
|
||||
$container->get('language_manager'),
|
||||
$container->get('config.factory'),
|
||||
$container->get('plugin.manager.field.field_type')
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\migrate_drupal\Plugin\migrate\field;
|
||||
|
||||
use Drupal\Core\Plugin\PluginBase;
|
||||
use Drupal\migrate\Plugin\MigrationInterface;
|
||||
use Drupal\migrate\Row;
|
||||
use Drupal\migrate_drupal\Plugin\MigrateFieldInterface;
|
||||
|
||||
/**
|
||||
* The base class for all field plugins.
|
||||
*
|
||||
* @see \Drupal\migrate\Plugin\MigratePluginManager
|
||||
* @see \Drupal\migrate_drupal\Annotation\MigrateField
|
||||
* @see \Drupal\migrate_drupal\Plugin\MigrateFieldInterface
|
||||
* @see plugin_api
|
||||
*
|
||||
* @ingroup migration
|
||||
*/
|
||||
abstract class FieldPluginBase extends PluginBase implements MigrateFieldInterface {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function processField(MigrationInterface $migration) {
|
||||
$process[0]['map'][$this->pluginId][$this->pluginId] = $this->pluginId;
|
||||
$migration->mergeProcessOfProperty('type', $process);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function processFieldInstance(MigrationInterface $migration) {
|
||||
// Nothing to do by default with field instances.
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function processFieldWidget(MigrationInterface $migration) {
|
||||
$process = [];
|
||||
foreach ($this->getFieldWidgetMap() as $source_widget => $destination_widget) {
|
||||
$process['type']['map'][$source_widget] = $destination_widget;
|
||||
}
|
||||
$migration->mergeProcessOfProperty('options/type', $process);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFieldWidgetMap() {
|
||||
// By default, use the plugin ID for the widget types.
|
||||
return [
|
||||
$this->pluginId => $this->pluginId . '_default',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function processFieldFormatter(MigrationInterface $migration) {
|
||||
$process = [];
|
||||
foreach ($this->getFieldFormatterMap() as $source_format => $destination_format) {
|
||||
$process[0]['map'][$this->pluginId][$source_format] = $destination_format;
|
||||
}
|
||||
$migration->mergeProcessOfProperty('options/type', $process);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFieldType(Row $row) {
|
||||
$field_type = $row->getSourceProperty('type');
|
||||
|
||||
if (isset($this->pluginDefinition['type_map'][$field_type])) {
|
||||
return $this->pluginDefinition['type_map'][$field_type];
|
||||
}
|
||||
else {
|
||||
return $field_type;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\migrate_drupal\Plugin\migrate\field;
|
||||
|
||||
use Drupal\migrate\Plugin\MigrationInterface;
|
||||
|
||||
/**
|
||||
* @MigrateField(
|
||||
* id = "nodereference",
|
||||
* core = {6},
|
||||
* type_map = {
|
||||
* "nodereference" = "entity_reference",
|
||||
* },
|
||||
* )
|
||||
*/
|
||||
class NodeReference extends FieldPluginBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFieldFormatterMap() {
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function processFieldValues(MigrationInterface $migration, $field_name, $data) {
|
||||
$process = [
|
||||
'plugin' => 'iterator',
|
||||
'source' => $field_name,
|
||||
'process' => [
|
||||
'target_id' => [
|
||||
'plugin' => 'migration_lookup',
|
||||
'migration' => 'd6_node',
|
||||
'source' => 'nid',
|
||||
],
|
||||
],
|
||||
];
|
||||
$migration->setProcessOfProperty($field_name, $process);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\migrate_drupal\Plugin\migrate\field;
|
||||
|
||||
use Drupal\migrate\Plugin\MigrationInterface;
|
||||
|
||||
/**
|
||||
* @MigrateField(
|
||||
* id = "userreference",
|
||||
* core = {6},
|
||||
* type_map = {
|
||||
* "userreference" = "entity_reference",
|
||||
* },
|
||||
* )
|
||||
*/
|
||||
class UserReference extends FieldPluginBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFieldFormatterMap() {
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function processFieldValues(MigrationInterface $migration, $field_name, $data) {
|
||||
$process = [
|
||||
'plugin' => 'iterator',
|
||||
'source' => $field_name,
|
||||
'process' => [
|
||||
'target_id' => [
|
||||
'plugin' => 'migration_lookup',
|
||||
'migration' => 'd6_user',
|
||||
'source' => 'uid',
|
||||
],
|
||||
],
|
||||
];
|
||||
$migration->setProcessOfProperty($field_name, $process);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,7 +10,6 @@ use Drupal\Core\State\StateInterface;
|
||||
use Drupal\migrate\Plugin\MigrationInterface;
|
||||
use Drupal\migrate\Exception\RequirementsException;
|
||||
use Drupal\migrate\Plugin\migrate\source\SqlBase;
|
||||
use Drupal\migrate\Plugin\RequirementsInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
/**
|
||||
@@ -19,11 +18,11 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
* Mainly to let children retrieve information from the origin system in an
|
||||
* easier way.
|
||||
*/
|
||||
abstract class DrupalSqlBase extends SqlBase implements ContainerFactoryPluginInterface, RequirementsInterface, DependentPluginInterface {
|
||||
abstract class DrupalSqlBase extends SqlBase implements ContainerFactoryPluginInterface, DependentPluginInterface {
|
||||
|
||||
use DependencyTrait;
|
||||
|
||||
/**
|
||||
/**
|
||||
* The contents of the system table.
|
||||
*
|
||||
* @var array
|
||||
@@ -53,14 +52,14 @@ abstract class DrupalSqlBase extends SqlBase implements ContainerFactoryPluginIn
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves all system data information from origin system.
|
||||
*
|
||||
* @return array
|
||||
* List of system table information keyed by type and name.
|
||||
*/
|
||||
public function getSystemData() {
|
||||
* Retrieves all system data information from origin system.
|
||||
*
|
||||
* @return array
|
||||
* List of system table information keyed by type and name.
|
||||
*/
|
||||
public function getSystemData() {
|
||||
if (!isset($this->systemData)) {
|
||||
$this->systemData = array();
|
||||
$this->systemData = [];
|
||||
try {
|
||||
$results = $this->select('system', 's')
|
||||
->fields('s')
|
||||
@@ -102,10 +101,11 @@ abstract class DrupalSqlBase extends SqlBase implements ContainerFactoryPluginIn
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw new RequirementsException('Missing source provider ' . $this->pluginDefinition['source_provider'], ['source_provider' => $this->pluginDefinition['source_provider']]);
|
||||
throw new RequirementsException('The module ' . $this->pluginDefinition['source_provider'] . ' is not enabled in the source site.', ['source_provider' => $this->pluginDefinition['source_provider']]);
|
||||
}
|
||||
}
|
||||
}
|
||||
parent::checkRequirements();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -149,7 +149,7 @@ abstract class DrupalSqlBase extends SqlBase implements ContainerFactoryPluginIn
|
||||
protected function variableGet($name, $default) {
|
||||
try {
|
||||
$result = $this->select('variable', 'v')
|
||||
->fields('v', array('value'))
|
||||
->fields('v', ['value'])
|
||||
->condition('name', $name)
|
||||
->execute()
|
||||
->fetchField();
|
||||
|
||||
@@ -37,7 +37,7 @@ class Variable extends DrupalSqlBase {
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function initializeIterator() {
|
||||
return new \ArrayIterator(array($this->values()));
|
||||
return new \ArrayIterator([$this->values()]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -75,7 +75,7 @@ class Variable extends DrupalSqlBase {
|
||||
public function query() {
|
||||
return $this->getDatabase()
|
||||
->select('variable', 'v')
|
||||
->fields('v', array('name', 'value'))
|
||||
->fields('v', ['name', 'value'])
|
||||
->condition('name', $this->variables, 'IN');
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ class VariableMultiRow extends DrupalSqlBase {
|
||||
*/
|
||||
public function query() {
|
||||
return $this->select('variable', 'v')
|
||||
->fields('v', array('name', 'value'))
|
||||
->fields('v', ['name', 'value'])
|
||||
// Cast scalars to array so we can consistently use an IN condition.
|
||||
->condition('name', (array) $this->configuration['variables'], 'IN');
|
||||
}
|
||||
@@ -30,10 +30,10 @@ class VariableMultiRow extends DrupalSqlBase {
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fields() {
|
||||
return array(
|
||||
return [
|
||||
'name' => $this->t('Name'),
|
||||
'value' => $this->t('Value'),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,7 +15,7 @@ abstract class FieldableEntity extends DrupalSqlBase {
|
||||
*
|
||||
* @param string $entity_type
|
||||
* The entity type ID.
|
||||
* @param string|NULL $bundle
|
||||
* @param string|null $bundle
|
||||
* (optional) The bundle.
|
||||
*
|
||||
* @return array[]
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\migrate_drupal\Plugin\migrate\source\d8;
|
||||
|
||||
use Drupal\migrate\Row;
|
||||
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
|
||||
|
||||
/**
|
||||
* Drupal config source from database.
|
||||
*
|
||||
* @MigrateSource(
|
||||
* id = "d8_config"
|
||||
* )
|
||||
*/
|
||||
class Config extends DrupalSqlBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function query() {
|
||||
$query = $this->select('config', 'c')
|
||||
->fields('c', ['collection', 'name', 'data']);
|
||||
if (!empty($this->configuration['collections'])) {
|
||||
$query->condition('collection', (array) $this->configuration['collections'], 'IN');
|
||||
}
|
||||
if (!empty($this->configuration['names'])) {
|
||||
$query->condition('name', (array) $this->configuration['names'], 'IN');
|
||||
}
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function prepareRow(Row $row) {
|
||||
$row->setSourceProperty('data', unserialize($row->getSourceProperty('data')));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fields() {
|
||||
return [
|
||||
'collection' => $this->t('The config object collection.'),
|
||||
'name' => $this->t('The config object name.'),
|
||||
'data' => $this->t('Serialized configuration object data.'),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getIds() {
|
||||
$ids['collection']['type'] = 'string';
|
||||
$ids['name']['type'] = 'string';
|
||||
return $ids;
|
||||
}
|
||||
|
||||
}
|
||||
+2294
-217
File diff suppressed because it is too large
Load Diff
+2936
-10
File diff suppressed because it is too large
Load Diff
+3
-3
@@ -5,8 +5,8 @@ package: Testing
|
||||
# version: VERSION
|
||||
# core: 8.x
|
||||
|
||||
# Information added by Drupal.org packaging script on 2016-08-03
|
||||
version: '8.1.8'
|
||||
# Information added by Drupal.org packaging script on 2017-08-16
|
||||
version: '8.3.7'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1470233792
|
||||
datestamp: 1502903957
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
name: 'Migrate field plugin manager test'
|
||||
type: module
|
||||
description: 'Example module demonstrating the field plugin manager in the Migrate API.'
|
||||
package: Testing
|
||||
# version: VERSION
|
||||
# core: 8.x
|
||||
|
||||
# Information added by Drupal.org packaging script on 2017-08-16
|
||||
version: '8.3.7'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1502903957
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Module for Migrate Field Plugin Manager testing.
|
||||
*/
|
||||
|
||||
use Drupal\migrate_field_plugin_manager_test\Plugin\migrate\cckfield\d6\FileField;
|
||||
|
||||
function migrate_field_plugin_manager_test_migrate_field_info_alter(array &$definitions) {
|
||||
if (isset($definitions['filefield'])) {
|
||||
$definitions['filefield']['class'] = FileField::class;
|
||||
}
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\migrate_field_plugin_manager_test\Plugin\migrate\cckfield\d6;
|
||||
|
||||
use Drupal\migrate\Plugin\MigrationInterface;
|
||||
use Drupal\migrate_drupal\Plugin\migrate\cckfield\CckFieldPluginBase;
|
||||
|
||||
/**
|
||||
* @MigrateCckField(
|
||||
* id = "filefield",
|
||||
* core = {6}
|
||||
* )
|
||||
*/
|
||||
class FileField extends CckFieldPluginBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFieldFormatterMap() {
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function processCckFieldValues(MigrationInterface $migration, $field_name, $data) {
|
||||
$migration->mergeProcessOfProperty($field_name, [
|
||||
'class' => __CLASS__,
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\migrate_field_plugin_manager_test\Plugin\migrate\field;
|
||||
|
||||
use Drupal\migrate_drupal\Plugin\migrate\field\FieldPluginBase;
|
||||
use Drupal\migrate\Plugin\MigrationInterface;
|
||||
|
||||
/**
|
||||
* @MigrateField(
|
||||
* id = "d6_file",
|
||||
* core = {6},
|
||||
* type_map = {
|
||||
* "file" = "file"
|
||||
* }
|
||||
* )
|
||||
*/
|
||||
class D6FileField extends FieldPluginBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFieldFormatterMap() {
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function processFieldValues(MigrationInterface $migration, $field_name, $data) {}
|
||||
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\migrate_field_plugin_manager_test\Plugin\migrate\field;
|
||||
|
||||
use Drupal\migrate_drupal\Plugin\migrate\field\FieldPluginBase;
|
||||
use Drupal\migrate\Plugin\MigrationInterface;
|
||||
|
||||
/**
|
||||
* @MigrateField(
|
||||
* id = "d6_no_core_version_specified"
|
||||
* )
|
||||
*/
|
||||
class D6NoCoreVersionSpecified extends FieldPluginBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFieldFormatterMap() {
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function processFieldValues(MigrationInterface $migration, $field_name, $data) {}
|
||||
|
||||
}
|
||||
+3
-3
@@ -5,8 +5,8 @@ package: Testing
|
||||
# version: VERSION
|
||||
# core: 8.x
|
||||
|
||||
# Information added by Drupal.org packaging script on 2016-08-03
|
||||
version: '8.1.8'
|
||||
# Information added by Drupal.org packaging script on 2017-08-16
|
||||
version: '8.3.7'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1470233792
|
||||
datestamp: 1502903957
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\Tests\migrate_drupal\Kernel;
|
||||
|
||||
use Drupal\migrate_field_plugin_manager_test\Plugin\migrate\cckfield\d6\FileField;
|
||||
use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class CckFieldBackwardsCompatibilityTest extends MigrateDrupal6TestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['file', 'migrate_field_plugin_manager_test'];
|
||||
|
||||
/**
|
||||
* Ensures that the cckfield backwards compatibility layer is invoked.
|
||||
*/
|
||||
public function testBackwardsCompatibility() {
|
||||
$migration = $this->container
|
||||
->get('plugin.manager.migration')
|
||||
->getDefinition('d6_node:story');
|
||||
|
||||
$this->assertSame(FileField::class, $migration['process']['field_test_filefield']['class']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,7 +14,7 @@ class MigrateCckFieldPluginManagerTest extends MigrateDrupalTestBase {
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = array('system', 'user', 'field', 'migrate_drupal', 'options', 'file', 'text', 'migrate_cckfield_plugin_manager_test');
|
||||
public static $modules = ['system', 'user', 'field', 'migrate_drupal', 'options', 'file', 'text', 'migrate_cckfield_plugin_manager_test'];
|
||||
|
||||
/**
|
||||
* Tests that the correct MigrateCckField plugins are used.
|
||||
@@ -22,32 +22,33 @@ class MigrateCckFieldPluginManagerTest extends MigrateDrupalTestBase {
|
||||
public function testPluginSelection() {
|
||||
$plugin_manager = \Drupal::service('plugin.manager.migrate.cckfield');
|
||||
|
||||
$this->assertIdentical('Drupal\\file\\Plugin\\migrate\\cckfield\\d6\\FileField', get_class($plugin_manager->createInstance('filefield', ['core' => 6])));
|
||||
$plugin_id = $plugin_manager->getPluginIdFromFieldType('filefield', ['core' => 6]);
|
||||
$this->assertIdentical('Drupal\\file\\Plugin\\migrate\\cckfield\\d6\\FileField', get_class($plugin_manager->createInstance($plugin_id, ['core' => 6])));
|
||||
|
||||
try {
|
||||
// If this test passes, createInstance will raise a
|
||||
// If this test passes, getPluginIdFromFieldType will raise a
|
||||
// PluginNotFoundException and we'll never reach fail().
|
||||
$plugin_manager->createInstance('filefield', ['core' => 7]);
|
||||
$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('Drupal\\file\\Plugin\\migrate\\cckfield\\d7\\ImageField', get_class($plugin_manager->createInstance('image', ['core' => 7])));
|
||||
$this->assertIdentical('Drupal\\file\\Plugin\\migrate\\cckfield\\d7\\FileField', get_class($plugin_manager->createInstance('file', ['core' => 7])));
|
||||
$this->assertIdentical('Drupal\\migrate_cckfield_plugin_manager_test\\Plugin\\migrate\\cckfield\\D6FileField', get_class($plugin_manager->createInstance('file', ['core' => 6])));
|
||||
$this->assertIdentical('image', $plugin_manager->getPluginIdFromFieldType('image', ['core' => 7]));
|
||||
$this->assertIdentical('file', $plugin_manager->getPluginIdFromFieldType('file', ['core' => 7]));
|
||||
$this->assertIdentical('d6_file', $plugin_manager->getPluginIdFromFieldType('file', ['core' => 6]));
|
||||
|
||||
$this->assertIdentical('Drupal\\text\\Plugin\\migrate\\cckfield\\TextField', get_class($plugin_manager->createInstance('text', ['core' => 6])));
|
||||
$this->assertIdentical('Drupal\\text\\Plugin\\migrate\\cckfield\\TextField', get_class($plugin_manager->createInstance('text', ['core' => 7])));
|
||||
$this->assertIdentical('text', $plugin_manager->getPluginIdFromFieldType('text', ['core' => 6]));
|
||||
$this->assertIdentical('text', $plugin_manager->getPluginIdFromFieldType('text', ['core' => 7]));
|
||||
|
||||
// Test fallback when no core version is specified.
|
||||
$this->assertIdentical('Drupal\\migrate_cckfield_plugin_manager_test\\Plugin\\migrate\\cckfield\\D6NoCoreVersionSpecified', get_class($plugin_manager->createInstance('d6_no_core_version_specified', ['core' => 6])));
|
||||
$this->assertIdentical('d6_no_core_version_specified', $plugin_manager->getPluginIdFromFieldType('d6_no_core_version_specified', ['core' => 6]));
|
||||
|
||||
try {
|
||||
// If this test passes, createInstance will raise a
|
||||
// If this test passes, getPluginIdFromFieldType will raise a
|
||||
// PluginNotFoundException and we'll never reach fail().
|
||||
$plugin_manager->createInstance('d6_no_core_version_specified', ['core' => 7]);
|
||||
$plugin_manager->getPluginIdFromFieldType('d6_no_core_version_specified', ['core' => 7]);
|
||||
$this->fail('Expected Drupal\Component\Plugin\Exception\PluginNotFoundException.');
|
||||
}
|
||||
catch (PluginNotFoundException $e) {
|
||||
|
||||
@@ -15,7 +15,7 @@ abstract class MigrateDrupalTestBase extends MigrateTestBase {
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('system', 'user', 'field', 'migrate_drupal', 'options', 'file');
|
||||
public static $modules = ['system', 'user', 'field', 'migrate_drupal', 'options', 'file'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\Tests\migrate_drupal\Kernel;
|
||||
|
||||
use Drupal\Component\Plugin\Exception\PluginNotFoundException;
|
||||
|
||||
/**
|
||||
* Tests the field plugin manager.
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class MigrateFieldPluginManagerTest extends MigrateDrupalTestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['system', 'user', 'field', 'migrate_drupal', 'options', 'file', 'text', 'migrate_field_plugin_manager_test'];
|
||||
|
||||
/**
|
||||
* Tests that the correct MigrateField plugins are used.
|
||||
*/
|
||||
public function testPluginSelection() {
|
||||
$plugin_manager = $this->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.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\Tests\migrate_drupal\Kernel\Plugin\migrate\source;
|
||||
|
||||
use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
|
||||
|
||||
/**
|
||||
* Tests the variable multirow source plugin.
|
||||
*
|
||||
* @covers \Drupal\migrate_drupal\Plugin\migrate\source\VariableMultiRow
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class VariableMultiRowTest extends MigrateSqlSourceTestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['migrate_drupal'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function providerSource() {
|
||||
$tests = [];
|
||||
|
||||
// The source data.
|
||||
$tests[0]['source_data']['variable'] = [
|
||||
['name' => 'foo', 'value' => 'i:1;'],
|
||||
['name' => 'bar', 'value' => 'b:0;'],
|
||||
];
|
||||
|
||||
// The expected results.
|
||||
$tests[0]['expected_data'] = [
|
||||
[
|
||||
'name' => 'foo',
|
||||
'value' => 1,
|
||||
],
|
||||
[
|
||||
'name' => 'bar',
|
||||
'value' => FALSE,
|
||||
],
|
||||
];
|
||||
|
||||
// The expected count.
|
||||
$tests[0]['expected_count'] = NULL;
|
||||
|
||||
// The source plugin configuration.
|
||||
$tests[0]['configuration']['variables'] = [
|
||||
'foo',
|
||||
'bar',
|
||||
];
|
||||
|
||||
return $tests;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\Tests\migrate_drupal\Kernel\Plugin\migrate\source;
|
||||
|
||||
use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
|
||||
|
||||
/**
|
||||
* Tests the variable source plugin.
|
||||
*
|
||||
* @covers \Drupal\migrate_drupal\Plugin\migrate\source\Variable
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class VariableTest extends MigrateSqlSourceTestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['migrate_drupal'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function providerSource() {
|
||||
$tests = [];
|
||||
|
||||
// The source data.
|
||||
$tests[0]['source_data']['variable'] = [
|
||||
['name' => 'foo', 'value' => 'i:1;'],
|
||||
['name' => 'bar', 'value' => 'b:0;'],
|
||||
];
|
||||
|
||||
// The expected results.
|
||||
$tests[0]['expected_data'] = [
|
||||
[
|
||||
'id' => 'foo',
|
||||
'foo' => 1,
|
||||
'bar' => FALSE,
|
||||
],
|
||||
];
|
||||
|
||||
// The expected count.
|
||||
$tests[0]['expected_count'] = NULL;
|
||||
|
||||
// The source plugin configuration.
|
||||
$tests[0]['configuration']['variables'] = [
|
||||
'foo',
|
||||
'bar',
|
||||
];
|
||||
|
||||
return $tests;
|
||||
}
|
||||
|
||||
}
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\Tests\migrate_drupal\Kernel\Plugin\migrate\source\d6;
|
||||
|
||||
use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
|
||||
|
||||
/**
|
||||
* Tests the variable source plugin.
|
||||
*
|
||||
* @covers \Drupal\migrate_drupal\Plugin\migrate\source\d6\i18nVariable
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class i18nVariableTest extends MigrateSqlSourceTestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['migrate_drupal'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function providerSource() {
|
||||
$tests = [];
|
||||
|
||||
// The source data.
|
||||
$tests[0]['source_data']['i18n_variable'] = [
|
||||
[
|
||||
'name' => 'site_slogan',
|
||||
'language' => 'fr',
|
||||
'value' => 's:19:"Migrate est génial";',
|
||||
],
|
||||
[
|
||||
'name' => 'site_name',
|
||||
'language' => 'fr',
|
||||
'value' => 's:11:"nom de site";',
|
||||
],
|
||||
[
|
||||
'name' => 'site_slogan',
|
||||
'language' => 'mi',
|
||||
'value' => 's:19:"Ko whakamataku heke";',
|
||||
],
|
||||
[
|
||||
'name' => 'site_name',
|
||||
'language' => 'mi',
|
||||
'value' => 's:9:"ingoa_pae";',
|
||||
],
|
||||
];
|
||||
|
||||
// The expected results.
|
||||
$tests[0]['expected_data'] = [
|
||||
[
|
||||
'language' => 'fr',
|
||||
'site_slogan' => 'Migrate est génial',
|
||||
'site_name' => 'nom de site',
|
||||
],
|
||||
[
|
||||
'language' => 'mi',
|
||||
'site_slogan' => 'Ko whakamataku heke',
|
||||
'site_name' => 'ingoa_pae',
|
||||
],
|
||||
];
|
||||
|
||||
// The expected count.
|
||||
$tests[0]['expected_count'] = NULL;
|
||||
|
||||
// The migration configuration.
|
||||
$tests[0]['configuration']['variables'] = [
|
||||
'site_slogan',
|
||||
'site_name',
|
||||
];
|
||||
|
||||
return $tests;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\Tests\migrate_drupal\Kernel\Plugin\migrate\source\d8;
|
||||
|
||||
use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
|
||||
|
||||
/**
|
||||
* Tests the config source plugin.
|
||||
*
|
||||
* @covers \Drupal\migrate_drupal\Plugin\migrate\source\d8\Config
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class ConfigTest extends MigrateSqlSourceTestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['migrate_drupal'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function providerSource() {
|
||||
$data = [];
|
||||
|
||||
// The source database tables.
|
||||
$data[0]['source_data'] = [
|
||||
'config' => [
|
||||
[
|
||||
'collection' => 'language.af',
|
||||
'name' => 'user.settings',
|
||||
'data' => 'a:1:{s:9:"anonymous";s:14:"af - Anonymous";}',
|
||||
],
|
||||
[
|
||||
'collection' => '',
|
||||
'name' => 'user.settings',
|
||||
'data' => 'a:1:{s:9:"anonymous";s:9:"Anonymous";}',
|
||||
],
|
||||
[
|
||||
'collection' => 'language.de',
|
||||
'name' => 'user.settings',
|
||||
'data' => 'a:1:{s:9:"anonymous";s:14:"de - Anonymous";}',
|
||||
],
|
||||
[
|
||||
'collection' => 'language.af',
|
||||
'name' => 'bar',
|
||||
'data' => 'b:0;',
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
// The expected results.
|
||||
$data[0]['expected_results'] = [
|
||||
[
|
||||
'collection' => 'language.af',
|
||||
'name' => 'user.settings',
|
||||
'data' => [
|
||||
'anonymous' => 'af - Anonymous',
|
||||
],
|
||||
],
|
||||
[
|
||||
'collection' => 'language.af',
|
||||
'name' => 'bar',
|
||||
'data' => FALSE,
|
||||
],
|
||||
];
|
||||
$data[0]['expected_count'] = NULL;
|
||||
$data[0]['configuration'] = [
|
||||
'names' => [
|
||||
'user.settings',
|
||||
'bar',
|
||||
],
|
||||
'collections' => [
|
||||
'language.af',
|
||||
]
|
||||
];
|
||||
|
||||
// Test with name and no collection in configuration.
|
||||
$data[1]['source_data'] = $data[0]['source_data'];
|
||||
$data[1]['expected_results'] = [
|
||||
[
|
||||
'collection' => 'language.af',
|
||||
'name' => 'bar',
|
||||
'data' => FALSE,
|
||||
],
|
||||
];
|
||||
$data[1]['expected_count'] = NULL;
|
||||
$data[1]['configuration'] = [
|
||||
'names' => [
|
||||
'bar',
|
||||
],
|
||||
];
|
||||
|
||||
// Test with collection and no name in configuration.
|
||||
$data[2]['source_data'] = $data[0]['source_data'];
|
||||
$data[2]['expected_results'] = [
|
||||
[
|
||||
'collection' => 'language.de',
|
||||
'name' => 'user.settings',
|
||||
'data' => [
|
||||
'anonymous' => 'de - Anonymous',
|
||||
],
|
||||
],
|
||||
];
|
||||
$data[2]['expected_count'] = NULL;
|
||||
$data[2]['configuration'] = [
|
||||
'collections' => [
|
||||
'language.de',
|
||||
],
|
||||
];
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -44,12 +44,12 @@ class EntityContentBaseTest extends MigrateDrupal6TestBase {
|
||||
'uid' => 2,
|
||||
'name' => 'Ford Prefect',
|
||||
'mail' => 'ford.prefect@localhost',
|
||||
'signature' => array(
|
||||
array(
|
||||
'signature' => [
|
||||
[
|
||||
'value' => 'Bring a towel.',
|
||||
'format' => 'filtered_html',
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
'init' => 'proto@zo.an',
|
||||
])->save();
|
||||
|
||||
|
||||
+10
-9
@@ -22,32 +22,33 @@ class MigrateDependenciesTest extends MigrateDrupal6TestBase {
|
||||
* Tests that the order is correct when loading several migrations.
|
||||
*/
|
||||
public function testMigrateDependenciesOrder() {
|
||||
$migration_items = array('d6_comment', 'd6_filter_format', 'd6_node:page');
|
||||
$migration_items = ['d6_comment', 'd6_filter_format', 'd6_node:page'];
|
||||
$migrations = $this->container->get('plugin.manager.migration')->createInstances($migration_items);
|
||||
$expected_order = array('d6_filter_format', 'd6_node:page', 'd6_comment');
|
||||
$expected_order = ['d6_filter_format', 'd6_node:page', 'd6_comment'];
|
||||
$this->assertIdentical(array_keys($migrations), $expected_order);
|
||||
$expected_requirements = array(
|
||||
$expected_requirements = [
|
||||
// d6_comment depends on d6_node:*, which the deriver expands into every
|
||||
// variant of d6_node.
|
||||
'd6_node:article',
|
||||
'd6_node:company',
|
||||
'd6_node:employee',
|
||||
'd6_node:event',
|
||||
'd6_node:forum',
|
||||
'd6_node:page',
|
||||
'd6_user',
|
||||
'd6_node_type',
|
||||
'd6_node_settings',
|
||||
'd6_filter_format',
|
||||
'd6_node:sponsor',
|
||||
'd6_node:story',
|
||||
'd6_node:test_event',
|
||||
'd6_node:test_page',
|
||||
'd6_node:test_planet',
|
||||
'd6_node:test_story',
|
||||
'd6_node_type',
|
||||
'd6_node_settings',
|
||||
'd6_filter_format',
|
||||
'd6_user',
|
||||
'd6_comment_type',
|
||||
'd6_comment_entity_display',
|
||||
'd6_comment_entity_form_display',
|
||||
);
|
||||
];
|
||||
// Migration dependencies for comment include dependencies for node
|
||||
// migration as well.
|
||||
$actual_requirements = $migrations['d6_comment']->get('requirements');
|
||||
@@ -66,7 +67,7 @@ class MigrateDependenciesTest extends MigrateDrupal6TestBase {
|
||||
$executable = new MigrateExecutable($migration, $this);
|
||||
$this->startCollectingMessages();
|
||||
$executable->import();
|
||||
$this->assertEqual($this->migrateMessages['error'], array(SafeMarkup::format('Migration @id did not meet the requirements. Missing migrations d6_aggregator_feed. requirements: d6_aggregator_feed.', array('@id' => $migration->id()))));
|
||||
$this->assertEqual($this->migrateMessages['error'], [SafeMarkup::format('Migration @id did not meet the requirements. Missing migrations d6_aggregator_feed. requirements: d6_aggregator_feed.', ['@id' => $migration->id()])]);
|
||||
$this->collectMessages = FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\Tests\migrate_drupal\Unit\source;
|
||||
|
||||
use Drupal\Tests\migrate\Unit\MigrateTestCase;
|
||||
use Drupal\migrate\Exception\RequirementsException;
|
||||
|
||||
/**
|
||||
* @coversDefaultClass Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class DrupalSqlBaseTest extends MigrateTestCase {
|
||||
|
||||
/**
|
||||
* Define bare minimum migration configuration.
|
||||
*/
|
||||
protected $migrationConfiguration = [
|
||||
'id' => 'DrupalSqlBase',
|
||||
];
|
||||
|
||||
/**
|
||||
* @var \Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase
|
||||
*/
|
||||
protected $base;
|
||||
|
||||
/**
|
||||
* Minimum database contents needed to test DrupalSqlBase.
|
||||
*/
|
||||
protected $databaseContents = [
|
||||
'system' => [
|
||||
[
|
||||
'filename' => 'sites/all/modules/module1',
|
||||
'name' => 'module1',
|
||||
'type' => 'module',
|
||||
'status' => 0,
|
||||
'schema_version' => -1,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* @covers ::checkRequirements
|
||||
*/
|
||||
public function testSourceProviderNotActive() {
|
||||
$plugin_definition['requirements_met'] = TRUE;
|
||||
$plugin_definition['source_provider'] = 'module1';
|
||||
/** @var \Drupal\Core\State\StateInterface $state */
|
||||
$state = $this->getMock('Drupal\Core\State\StateInterface');
|
||||
/** @var \Drupal\Core\Entity\EntityManagerInterface $entity_manager */
|
||||
$entity_manager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
|
||||
$plugin = new TestDrupalSqlBase([], 'placeholder_id', $plugin_definition, $this->getMigration(), $state, $entity_manager);
|
||||
$plugin->setDatabase($this->getDatabase($this->databaseContents));
|
||||
$system_data = $plugin->getSystemData();
|
||||
$this->setExpectedException(RequirementsException::class, 'The module module1 is not enabled in the source site.');
|
||||
try {
|
||||
$plugin->checkRequirements();
|
||||
}
|
||||
catch (RequirementsException $e) {
|
||||
// Ensure requirements are set on the exception.
|
||||
$this->assertEquals(['source_provider' => 'module1'], $e->getRequirements());
|
||||
// Re-throw so PHPUnit can assert the exception.
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace Drupal\Tests\migrate_drupal\Unit\source;
|
||||
|
||||
use Drupal\Core\Database\Connection;
|
||||
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
|
||||
|
||||
/**
|
||||
* Extends the DrupalSqlBase abstract class.
|
||||
*/
|
||||
class TestDrupalSqlBase extends DrupalSqlBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fields() {
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function query() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Tweaks DrupalSqlBase to set a new database connection for tests.
|
||||
*
|
||||
* @param \Drupal\Core\Database\Connection $database
|
||||
* The new connection to use.
|
||||
*
|
||||
* @see \Drupal\Tests\migrate\Unit\MigrateSourceSqlTestCase
|
||||
*/
|
||||
public function setDatabase(Connection $database) {
|
||||
$this->database = $database;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getIds() {
|
||||
return [];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,27 +14,27 @@ abstract class VariableMultiRowTestBase extends MigrateSqlSourceTestCase {
|
||||
const PLUGIN_CLASS = 'Drupal\migrate_drupal\Plugin\migrate\source\VariableMultiRow';
|
||||
|
||||
// The fake Migration configuration entity.
|
||||
protected $migrationConfiguration = array(
|
||||
protected $migrationConfiguration = [
|
||||
'id' => 'test',
|
||||
'source' => array(
|
||||
'source' => [
|
||||
'plugin' => 'd6_variable_multirow',
|
||||
'variables' => array(
|
||||
'variables' => [
|
||||
'foo',
|
||||
'bar',
|
||||
),
|
||||
),
|
||||
);
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
protected $expectedResults = array(
|
||||
array('name' => 'foo', 'value' => 1),
|
||||
array('name' => 'bar', 'value' => FALSE),
|
||||
);
|
||||
protected $expectedResults = [
|
||||
['name' => 'foo', 'value' => 1],
|
||||
['name' => 'bar', 'value' => FALSE],
|
||||
];
|
||||
|
||||
protected $databaseContents = array(
|
||||
'variable' => array(
|
||||
array('name' => 'foo', 'value' => 'i:1;'),
|
||||
array('name' => 'bar', 'value' => 'b:0;'),
|
||||
),
|
||||
);
|
||||
protected $databaseContents = [
|
||||
'variable' => [
|
||||
['name' => 'foo', 'value' => 'i:1;'],
|
||||
['name' => 'bar', 'value' => 'b:0;'],
|
||||
],
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
@@ -13,31 +13,31 @@ class VariableTest extends MigrateSqlSourceTestCase {
|
||||
|
||||
const PLUGIN_CLASS = 'Drupal\migrate_drupal\Plugin\migrate\source\Variable';
|
||||
|
||||
protected $migrationConfiguration = array(
|
||||
protected $migrationConfiguration = [
|
||||
'id' => 'test',
|
||||
'highWaterProperty' => array('field' => 'test'),
|
||||
'source' => array(
|
||||
'highWaterProperty' => ['field' => 'test'],
|
||||
'source' => [
|
||||
'plugin' => 'd6_variable',
|
||||
'variables' => array(
|
||||
'variables' => [
|
||||
'foo',
|
||||
'bar',
|
||||
),
|
||||
),
|
||||
);
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
protected $expectedResults = array(
|
||||
array(
|
||||
protected $expectedResults = [
|
||||
[
|
||||
'id' => 'foo',
|
||||
'foo' => 1,
|
||||
'bar' => FALSE,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
protected $databaseContents = array(
|
||||
'variable' => array(
|
||||
array('name' => 'foo', 'value' => 'i:1;'),
|
||||
array('name' => 'bar', 'value' => 'b:0;'),
|
||||
),
|
||||
);
|
||||
protected $databaseContents = [
|
||||
'variable' => [
|
||||
['name' => 'foo', 'value' => 'i:1;'],
|
||||
['name' => 'bar', 'value' => 'b:0;'],
|
||||
],
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
@@ -19,9 +19,9 @@ class Drupal6SqlBaseTest extends MigrateTestCase {
|
||||
/**
|
||||
* Define bare minimum migration configuration.
|
||||
*/
|
||||
protected $migrationConfiguration = array(
|
||||
protected $migrationConfiguration = [
|
||||
'id' => 'Drupal6SqlBase',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* @var \Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase
|
||||
@@ -31,37 +31,37 @@ class Drupal6SqlBaseTest extends MigrateTestCase {
|
||||
/**
|
||||
* Minimum database contents needed to test Drupal6SqlBase.
|
||||
*/
|
||||
protected $databaseContents = array(
|
||||
'system' => array(
|
||||
array(
|
||||
protected $databaseContents = [
|
||||
'system' => [
|
||||
[
|
||||
'filename' => 'sites/all/modules/module1',
|
||||
'name' => 'module1',
|
||||
'type' => 'module',
|
||||
'status' => 1,
|
||||
'schema_version' => -1,
|
||||
),
|
||||
array(
|
||||
],
|
||||
[
|
||||
'filename' => 'sites/all/modules/module2',
|
||||
'name' => 'module2',
|
||||
'type' => 'module',
|
||||
'status' => 0,
|
||||
'schema_version' => 7201,
|
||||
),
|
||||
array(
|
||||
],
|
||||
[
|
||||
'filename' => 'sites/all/modules/test2',
|
||||
'name' => 'test2',
|
||||
'type' => 'theme',
|
||||
'status' => 1,
|
||||
'schema_version' => -1,
|
||||
),
|
||||
),
|
||||
'variable' => array(
|
||||
array(
|
||||
],
|
||||
],
|
||||
'variable' => [
|
||||
[
|
||||
'name' => 'my_variable',
|
||||
'value' => 'b:1;',
|
||||
),
|
||||
),
|
||||
);
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
@@ -72,7 +72,7 @@ class Drupal6SqlBaseTest extends MigrateTestCase {
|
||||
$state = $this->getMock('Drupal\Core\State\StateInterface');
|
||||
/** @var \Drupal\Core\Entity\EntityManagerInterface $entity_manager */
|
||||
$entity_manager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
|
||||
$this->base = new TestDrupal6SqlBase($this->migrationConfiguration, $plugin, array(), $this->getMigration(), $state, $entity_manager);
|
||||
$this->base = new TestDrupal6SqlBase($this->migrationConfiguration, $plugin, [], $this->getMigration(), $state, $entity_manager);
|
||||
$this->base->setDatabase($this->getDatabase($this->databaseContents));
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ class TestDrupal6SqlBase extends DrupalSqlBase {
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fields() {
|
||||
return array(
|
||||
return [
|
||||
'filename' => t('The path of the primary file for this item.'),
|
||||
'name' => t('The name of the item; e.g. node.'),
|
||||
'type' => t('The type of the item, either module, theme, or theme_engine.'),
|
||||
@@ -154,7 +154,7 @@ class TestDrupal6SqlBase extends DrupalSqlBase {
|
||||
'schema_version' => t('The module\'s database schema version number.'),
|
||||
'weight' => t('The order in which this module\'s hooks should be invoked.'),
|
||||
'info' => t('A serialized array containing information from the module\'s .info file.'),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -163,14 +163,14 @@ class TestDrupal6SqlBase extends DrupalSqlBase {
|
||||
public function query() {
|
||||
$query = $this->database
|
||||
->select('system', 's')
|
||||
->fields('s', array('filename', 'name', 'schema_version'));
|
||||
->fields('s', ['filename', 'name', 'schema_version']);
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tweaks Drupal6SqlBase to set a new database connection for tests.
|
||||
*
|
||||
* @param \Drupal\Core\Database\Connection
|
||||
* @param \Drupal\Core\Database\Connection $database
|
||||
* The new connection to use.
|
||||
*
|
||||
* @see \Drupal\Tests\migrate\Unit\MigrateSqlTestCase
|
||||
@@ -182,7 +182,7 @@ class TestDrupal6SqlBase extends DrupalSqlBase {
|
||||
/**
|
||||
* Tweaks Drupal6SqlBase to set a new module handler for tests.
|
||||
*
|
||||
* @param \Drupal\Core\Extension\ModuleHandlerInterface
|
||||
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
|
||||
* The new module handler to use.
|
||||
*
|
||||
* @see \Drupal\Tests\migrate\Unit\MigrateSqlTestCase
|
||||
@@ -216,7 +216,7 @@ class TestDrupal6SqlBase extends DrupalSqlBase {
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getIds() {
|
||||
return array();
|
||||
return [];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ class i18nVariableTest extends MigrateSqlSourceTestCase {
|
||||
*/
|
||||
protected $migrationConfiguration = [
|
||||
'id' => 'test',
|
||||
'highWaterProperty' => array('field' => 'test'),
|
||||
'highWaterProperty' => ['field' => 'test'],
|
||||
'source' => [
|
||||
'plugin' => 'i18n_variable',
|
||||
'variables' => [
|
||||
@@ -51,10 +51,10 @@ class i18nVariableTest extends MigrateSqlSourceTestCase {
|
||||
*/
|
||||
protected $databaseContents = [
|
||||
'i18n_variable' => [
|
||||
array('name' => 'site_slogan', 'language' => 'fr', 'value' => 's:19:"Migrate est génial";'),
|
||||
array('name' => 'site_name', 'language' => 'fr', 'value' => 's:11:"nom de site";'),
|
||||
array('name' => 'site_slogan', 'language' => 'mi', 'value' => 's:19:"Ko whakamataku heke";'),
|
||||
array('name' => 'site_name', 'language' => 'mi', 'value' => 's:9:"ingoa_pae";'),
|
||||
['name' => 'site_slogan', 'language' => 'fr', 'value' => 's:19:"Migrate est génial";'],
|
||||
['name' => 'site_name', 'language' => 'fr', 'value' => 's:11:"nom de site";'],
|
||||
['name' => 'site_slogan', 'language' => 'mi', 'value' => 's:19:"Ko whakamataku heke";'],
|
||||
['name' => 'site_name', 'language' => 'mi', 'value' => 's:9:"ingoa_pae";'],
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user