updated core to 8.6.1 via composer

This commit is contained in:
2018-09-12 13:58:26 +02:00
parent a9a219f2ed
commit ea56b9fba3
4443 changed files with 112098 additions and 40708 deletions
@@ -3,3 +3,8 @@
enforce_source_module_tags:
- Drupal 6
- Drupal 7
# Migrations with any of these tags will not be derived and executed with the
# other migrations. They will be derived and executed after the migrations on
# which they depend have been successfully executed.
follow_up_migration_tags:
- Follow-up migration
@@ -8,3 +8,9 @@ migrate_drupal.settings:
sequence:
type: string
label: 'Tag'
follow_up_migration_tags:
type: sequence
label: 'Follow-up migration tags'
sequence:
type: string
label: 'Tag'
@@ -1,8 +1,8 @@
name: Migrate Drupal
type: module
description: 'Contains migrations from older Drupal versions.'
package: Core (Experimental)
package: Migration
version: VERSION
core: 8.x
dependencies:
- migrate
- drupal:migrate
@@ -14,3 +14,20 @@ function migrate_drupal_update_8501() {
->set('enforce_source_module_tags', ['Drupal 6', 'Drupal 7'])
->save();
}
/**
* Sets the follow-up migration tags.
*/
function migrate_drupal_update_8502() {
\Drupal::configFactory()
->getEditable('migrate_drupal.settings')
->set('follow_up_migration_tags', ['Follow-up migration'])
->save();
}
/**
* Install migrate_drupal_multilingual since migrate_drupal is installed.
*/
function migrate_drupal_update_8601() {
\Drupal::service('module_installer')->install(['migrate_drupal_multilingual']);
}
@@ -55,7 +55,7 @@ class MigrateField extends Plugin {
* Identifies the system providing the data the field plugin will read.
*
* The source_module is expected to be the name of a Drupal module that must
* must be installed in the source database.
* be installed in the source database.
*
* @var string
*/
@@ -12,6 +12,13 @@ use Drupal\migrate\Plugin\RequirementsInterface;
*/
trait MigrationConfigurationTrait {
/**
* The follow-up migration tags.
*
* @var string[]
*/
protected $followUpMigrationTags;
/**
* Gets the database connection for the source Drupal database.
*
@@ -96,6 +103,19 @@ trait MigrationConfigurationTrait {
$all_migrations = $plugin_manager->createInstancesByTag($version_tag);
$migrations = [];
foreach ($all_migrations as $migration) {
// Skip migrations tagged with any of the follow-up migration tags. They
// will be derived and executed after the migrations on which they depend
// have been successfully executed.
// @see Drupal\migrate_drupal\Plugin\MigrationWithFollowUpInterface
if (!empty(array_intersect($migration->getMigrationTags(), $this->getFollowUpMigrationTags()))) {
continue;
}
// Multilingual migrations require migrate_drupal_multilingual.
$tags = $migration->getMigrationTags() ?: [];
if (in_array('Multilingual', $tags, TRUE) && (!\Drupal::service('module_handler')->moduleExists('migrate_drupal_multilingual'))) {
throw new RequirementsException(sprintf("Install migrate_drupal_multilingual to run migration '%s'.", $migration->getPluginId()));
}
try {
// @todo https://drupal.org/node/2681867 We should be able to validate
// the entire migration at this point.
@@ -119,6 +139,20 @@ trait MigrationConfigurationTrait {
return $migrations;
}
/**
* Returns the follow-up migration tags.
*
* @return string[]
*/
protected function getFollowUpMigrationTags() {
if ($this->followUpMigrationTags === NULL) {
$this->followUpMigrationTags = \Drupal::configFactory()
->get('migrate_drupal.settings')
->get('follow_up_migration_tags') ?: [];
}
return $this->followUpMigrationTags;
}
/**
* Determines what version of Drupal the source database contains.
*
@@ -17,7 +17,7 @@ interface MigrateFieldInterface extends PluginInspectionInterface {
* @param \Drupal\migrate\Plugin\MigrationInterface $migration
* The migration entity.
*/
public function processField(MigrationInterface $migration);
public function alterFieldMigration(MigrationInterface $migration);
/**
* Apply any custom processing to the field instance migration.
@@ -25,7 +25,7 @@ interface MigrateFieldInterface extends PluginInspectionInterface {
* @param \Drupal\migrate\Plugin\MigrationInterface $migration
* The migration entity.
*/
public function processFieldInstance(MigrationInterface $migration);
public function alterFieldInstanceMigration(MigrationInterface $migration);
/**
* Apply any custom processing to the field widget migration.
@@ -33,7 +33,7 @@ interface MigrateFieldInterface extends PluginInspectionInterface {
* @param \Drupal\migrate\Plugin\MigrationInterface $migration
* The migration entity.
*/
public function processFieldWidget(MigrationInterface $migration);
public function alterFieldWidgetMigration(MigrationInterface $migration);
/**
* Apply any custom processing to the field formatter migration.
@@ -41,7 +41,7 @@ interface MigrateFieldInterface extends PluginInspectionInterface {
* @param \Drupal\migrate\Plugin\MigrationInterface $migration
* The migration entity.
*/
public function processFieldFormatter(MigrationInterface $migration);
public function alterFieldFormatterMigration(MigrationInterface $migration);
/**
* Get the field formatter type from the source.
@@ -57,7 +57,7 @@ interface MigrateFieldInterface extends PluginInspectionInterface {
/**
* Get a map between D6 formatters and D8 formatters for this field type.
*
* This is used by static::processFieldFormatter() in the base class.
* This is used by static::alterFieldFormatterMigration() in the base class.
*
* @return array
* The keys are D6 formatters and the values are D8 formatters.
@@ -93,7 +93,7 @@ interface MigrateFieldInterface extends PluginInspectionInterface {
* @param array $data
* The array of field data from FieldValues::fieldData().
*/
public function processFieldValues(MigrationInterface $migration, $field_name, $data);
public function defineValueProcessPipeline(MigrationInterface $migration, $field_name, $data);
/**
* Computes the destination type of a migrated field.
@@ -0,0 +1,40 @@
<?php
namespace Drupal\migrate_drupal\Plugin;
/**
* Interface for migrations with follow-up migrations.
*
* Some migrations need to be derived and executed after other migrations have
* been successfully executed. For example, a migration might need to be derived
* based on previously migrated data. For such a case, the migration dependency
* system is not enough since all migrations would still be derived before any
* one of them has been executed.
*
* Those "follow-up" migrations need to be tagged with the "Follow-up migration"
* tag (or any tag in the "follow_up_migration_tags" configuration) and thus
* they won't be derived with the other migrations.
*
* To get those follow-up migrations derived at the right time, the migrations
* on which they depend must implement this interface and generate them in the
* generateFollowUpMigrations() method.
*
* When the migrations implementing this interface have been successfully
* executed, the follow-up migrations will then be derived having access to the
* now migrated data.
*/
interface MigrationWithFollowUpInterface {
/**
* Generates follow-up migrations.
*
* When the migration implementing this interface has been succesfully
* executed, this method will be used to generate the follow-up migrations
* which depends on the now migrated data.
*
* @return \Drupal\migrate\Plugin\MigrationInterface[]
* The follow-up migrations.
*/
public function generateFollowUpMigrations();
}
@@ -0,0 +1,193 @@
<?php
namespace Drupal\migrate_drupal\Plugin\migrate;
use Drupal\Component\Plugin\Derivative\DeriverBase;
use Drupal\Component\Plugin\PluginBase;
use Drupal\Core\Entity\EntityFieldManagerInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Plugin\Discovery\ContainerDeriverInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Deriver for entity reference field translations.
*
* A migration will be created for every bundle with at least one entity
* reference field that is configured to point to one of the supported target
* entity types. The migrations will update the entity reference fields with
* values found in the mapping tables of the migrations associated with the
* target types.
*
* Example:
*
* @code
* id: d7_entity_reference_translation
* label: Entity reference translations
* migration_tags:
* - Drupal 7
* - Follow-up migration
* deriver: Drupal\migrate_drupal\Plugin\migrate\EntityReferenceTranslationDeriver
* target_types:
* node:
* - d7_node_translation
* source:
* plugin: empty
* key: default
* target: default
* process: []
* destination:
* plugin: null
* @endcode
*
* In this example, the only supported target type is 'node' and the associated
* migration for the mapping table lookup is 'd7_node_translation'.
*/
class EntityReferenceTranslationDeriver extends DeriverBase implements ContainerDeriverInterface {
use StringTranslationTrait;
/**
* The entity field manager.
*
* @var \Drupal\Core\Entity\EntityFieldManagerInterface
*/
protected $entityFieldManager;
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
/**
* EntityReferenceTranslationDeriver constructor.
*
* @param string $base_plugin_id
* The base plugin ID.
* @param \Drupal\core\Entity\EntityFieldManagerInterface $entity_field_manager
* The entity field manager.
* @param \Drupal\core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
*/
public function __construct($base_plugin_id, EntityFieldManagerInterface $entity_field_manager, EntityTypeManagerInterface $entity_type_manager) {
$this->entityFieldManager = $entity_field_manager;
$this->entityTypeManager = $entity_type_manager;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, $base_plugin_id) {
return new static(
$base_plugin_id,
$container->get('entity_field.manager'),
$container->get('entity_type.manager')
);
}
/**
* {@inheritdoc}
*/
public function getDerivativeDefinitions($base_plugin_definition) {
// Get all entity reference fields.
$field_map = $this->entityFieldManager->getFieldMapByFieldType('entity_reference');
foreach ($field_map as $entity_type => $fields) {
foreach ($fields as $field_name => $field) {
foreach ($field['bundles'] as $bundle) {
$field_definitions = $this->entityFieldManager->getFieldDefinitions($entity_type, $bundle);
$target_type = $field_definitions[$field_name]->getSetting('target_type');
// If the field's target type is not supported, skip it.
if (!array_key_exists($target_type, $base_plugin_definition['target_types'])) {
continue;
}
// Key derivatives by entity types and bundles.
$derivative_key = $entity_type . '__' . $bundle;
$derivative = $base_plugin_definition;
$entity_type_definition = $this->entityTypeManager->getDefinition($entity_type);
// Set the migration label.
$derivative['label'] = $this->t('@label (@derivative)', [
'@label' => $base_plugin_definition['label'],
'@derivative' => $derivative_key,
]);
// Set the source plugin.
$derivative['source']['plugin'] = 'content_entity' . PluginBase::DERIVATIVE_SEPARATOR . $entity_type;
if ($entity_type_definition->hasKey('bundle')) {
$derivative['source']['bundle'] = $bundle;
}
// Set the process pipeline.
$id_key = $entity_type_definition->getKey('id');
$derivative['process'][$id_key] = $id_key;
if ($entity_type_definition->isRevisionable()) {
$revision_key = $entity_type_definition->getKey('revision');
$derivative['process'][$revision_key] = $revision_key;
}
if ($entity_type_definition->isTranslatable()) {
$langcode_key = $entity_type_definition->getKey('langcode');
$derivative['process'][$langcode_key] = $langcode_key;
}
// Set the destination plugin.
$derivative['destination']['plugin'] = 'entity' . PluginBase::DERIVATIVE_SEPARATOR . $entity_type;
if ($entity_type_definition->hasKey('bundle')) {
$derivative['destination']['default_bundle'] = $bundle;
}
if ($entity_type_definition->isTranslatable()) {
$derivative['destination']['translations'] = TRUE;
}
// Allow overwriting the entity reference field so we can update its
// values with the ones found in the mapping table.
$derivative['destination']['overwrite_properties'][$field_name] = $field_name;
// Add the entity reference field to the process pipeline.
$derivative['process'][$field_name] = [
'plugin' => 'sub_process',
'source' => $field_name,
'process' => [
'target_id' => [
[
'plugin' => 'migration_lookup',
'source' => 'target_id',
'migration' => $base_plugin_definition['target_types'][$target_type],
'no_stub' => TRUE,
],
[
'plugin' => 'skip_on_empty',
'method' => 'row',
],
[
'plugin' => 'extract',
'index' => [0],
],
],
],
];
if (!isset($this->derivatives[$derivative_key])) {
// If this is a new derivative, add it to the returned derivatives.
$this->derivatives[$derivative_key] = $derivative;
}
else {
// If this is an existing derivative, it means this bundle has more
// than one entity reference field. In that case, we only want to add
// the field to the process pipeline and make it overwritable.
$this->derivatives[$derivative_key]['process'] += $derivative['process'];
$this->derivatives[$derivative_key]['destination']['overwrite_properties'] += $derivative['destination']['overwrite_properties'];
}
}
}
}
return $this->derivatives;
}
}
@@ -21,16 +21,9 @@ use Drupal\migrate_drupal\Plugin\MigrateCckFieldInterface;
abstract class CckFieldPluginBase extends FieldPluginBase implements MigrateCckFieldInterface {
/**
* 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().
* {@inheritdoc}
*/
public function processFieldValues(MigrationInterface $migration, $field_name, $data) {
public function defineValueProcessPipeline(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);
@@ -20,24 +20,66 @@ use Drupal\migrate_drupal\Plugin\MigrateFieldInterface;
abstract class FieldPluginBase extends PluginBase implements MigrateFieldInterface {
/**
* {@inheritdoc}
* Alters the migration for field definitions.
*
* @deprecated in Drupal 8.6.0, to be removed before Drupal 9.0.0. Use
* alterFieldMigration() instead.
*
* @see https://www.drupal.org/node/2944598
* @see ::alterFieldMigration()
*/
public function processField(MigrationInterface $migration) {
@trigger_error('Deprecated in Drupal 8.6.0, to be removed before Drupal 9.0.0. Use alterFieldMigration() instead. See https://www.drupal.org/node/2944598.', E_USER_DEPRECATED);
$this->alterFieldMigration($migration);
}
/**
* {@inheritdoc}
*/
public function alterFieldMigration(MigrationInterface $migration) {
$process[0]['map'][$this->pluginId][$this->pluginId] = $this->pluginId;
$migration->mergeProcessOfProperty('type', $process);
}
/**
* {@inheritdoc}
* Alert field instance migration.
*
* @deprecated in Drupal 8.6.0, to be removed before Drupal 9.0.0. Use
* alterFieldInstanceMigration() instead.
*
* @see https://www.drupal.org/node/2944598
* @see ::alterFieldInstanceMigration()
*/
public function processFieldInstance(MigrationInterface $migration) {
// Nothing to do by default with field instances.
@trigger_error('Deprecated in Drupal 8.6.0, to be removed before Drupal 9.0.0. Use alterFieldInstanceMigration() instead. See https://www.drupal.org/node/2944598.', E_USER_DEPRECATED);
$this->alterFieldInstanceMigration($migration);
}
/**
* {@inheritdoc}
*/
public function alterFieldInstanceMigration(MigrationInterface $migration) {
// Nothing to do by default with field instances.
}
/**
* Alter field widget migration.
*
* @deprecated in Drupal 8.6.0, to be removed before Drupal 9.0.0. Use
* alterFieldWidgetMigration() instead.
*
* @see https://www.drupal.org/node/2944598
* @see ::alterFieldWidgetMigration()
*/
public function processFieldWidget(MigrationInterface $migration) {
@trigger_error('Deprecated in Drupal 8.6.0, to be removed before Drupal 9.0.0. Use alterFieldWidgetMigration() instead. See https://www.drupal.org/node/2944598.', E_USER_DEPRECATED);
$this->alterFieldWidgetMigration($migration);
}
/**
* {@inheritdoc}
*/
public function alterFieldWidgetMigration(MigrationInterface $migration) {
$process = [];
foreach ($this->getFieldWidgetMap() as $source_widget => $destination_widget) {
$process['type']['map'][$source_widget] = $destination_widget;
@@ -77,11 +119,24 @@ abstract class FieldPluginBase extends PluginBase implements MigrateFieldInterfa
}
/**
* {@inheritdoc}
* Alter field formatter migration.
*
* @deprecated in Drupal 8.6.0, to be removed before Drupal 9.0.0. Use
* alterFieldFormatterMigration() instead.
*
* @see https://www.drupal.org/node/2944598
* @see ::processFieldFormatter()
*/
public function processFieldFormatter(MigrationInterface $migration) {
$process = [];
@trigger_error('Deprecated in Drupal 8.6.0, to be removed before Drupal 9.0.0. Use alterFieldFormatterMigration() instead. See https://www.drupal.org/node/2944598.', E_USER_DEPRECATED);
$this->alterFieldFormatterMigration($migration);
}
/**
* {@inheritdoc}
*/
public function alterFieldFormatterMigration(MigrationInterface $migration) {
$process = [];
// Some migrate field plugin IDs are prefixed with 'd6_' or 'd7_'. Since the
// plugin ID is used in the static map as the module name, we have to remove
// this prefix from the plugin ID.
@@ -93,9 +148,23 @@ abstract class FieldPluginBase extends PluginBase implements MigrateFieldInterfa
}
/**
* {@inheritdoc}
* Defines the process pipeline for field values.
*
* @deprecated in Drupal 8.6.0, to be removed before Drupal 9.0.0. Use
* defineValueProcessPipeline() instead.
*
* @see https://www.drupal.org/node/2944598
* @see ::defineValueProcessPipeline()
*/
public function processFieldValues(MigrationInterface $migration, $field_name, $data) {
@trigger_error('Deprecated in Drupal 8.6.0, to be removed before Drupal 9.0.0. Use defineValueProcessPipeline() instead. See https://www.drupal.org/node/2944598.', E_USER_DEPRECATED);
return $this->defineValueProcessPipeline($migration, $field_name, $data);
}
/**
* {@inheritdoc}
*/
public function defineValueProcessPipeline(MigrationInterface $migration, $field_name, $data) {
$process = [
'plugin' => 'get',
'source' => $field_name,
@@ -20,14 +20,13 @@ class NodeReference extends FieldPluginBase {
/**
* {@inheritdoc}
*/
public function processFieldValues(MigrationInterface $migration, $field_name, $data) {
public function defineValueProcessPipeline(MigrationInterface $migration, $field_name, $data) {
$process = [
'plugin' => 'sub_process',
'source' => $field_name,
'process' => [
'target_id' => [
'plugin' => 'migration_lookup',
'migration' => 'd6_node',
'plugin' => 'get',
'source' => 'nid',
],
],
@@ -20,7 +20,7 @@ class UserReference extends FieldPluginBase {
/**
* {@inheritdoc}
*/
public function processFieldValues(MigrationInterface $migration, $field_name, $data) {
public function defineValueProcessPipeline(MigrationInterface $migration, $field_name, $data) {
$process = [
'plugin' => 'sub_process',
'source' => $field_name,
@@ -22,13 +22,18 @@ abstract class FieldableEntity extends DrupalSqlBase {
* The field instances, keyed by field name.
*/
protected function getFields($entity_type, $bundle = NULL) {
return $this->select('field_config_instance', 'fci')
$query = $this->select('field_config_instance', 'fci')
->fields('fci')
->condition('entity_type', $entity_type)
->condition('bundle', isset($bundle) ? $bundle : $entity_type)
->condition('deleted', 0)
->execute()
->fetchAllAssoc('field_name');
->condition('fci.entity_type', $entity_type)
->condition('fci.bundle', isset($bundle) ? $bundle : $entity_type)
->condition('fci.deleted', 0);
// Join the 'field_config' table and add the 'translatable' setting to the
// query.
$query->leftJoin('field_config', 'fc', 'fci.field_id = fc.id');
$query->addField('fc', 'translatable');
return $query->execute()->fetchAllAssoc('field_name');
}
/**
@@ -42,13 +47,13 @@ abstract class FieldableEntity extends DrupalSqlBase {
* The entity ID.
* @param int|null $revision_id
* (optional) The entity revision ID.
* @param string $language
* (optional) The field language.
*
* @return array
* The raw field values, keyed by delta.
*
* @todo Support multilingual field values.
*/
protected function getFieldValues($entity_type, $field, $entity_id, $revision_id = NULL) {
protected function getFieldValues($entity_type, $field, $entity_id, $revision_id = NULL, $language = NULL) {
$table = (isset($revision_id) ? 'field_revision_' : 'field_data_') . $field;
$query = $this->select($table, 't')
->fields('t')
@@ -58,6 +63,11 @@ abstract class FieldableEntity extends DrupalSqlBase {
if (isset($revision_id)) {
$query->condition('revision_id', $revision_id);
}
// Add 'language' as a query condition if it has been defined by Entity
// Translation.
if ($language) {
$query->condition('language', $language);
}
$values = [];
foreach ($query->execute() as $row) {
foreach ($row as $key => $value) {
@@ -71,4 +81,44 @@ abstract class FieldableEntity extends DrupalSqlBase {
return $values;
}
/**
* Checks if an entity type uses Entity Translation.
*
* @param string $entity_type
* The entity type.
*
* @return bool
* Whether the entity type uses entity translation.
*/
protected function isEntityTranslatable($entity_type) {
return in_array($entity_type, $this->variableGet('entity_translation_entity_types', []), TRUE);
}
/**
* Gets an entity source language from the 'entity_translation' table.
*
* @param string $entity_type
* The entity type.
* @param int $entity_id
* The entity ID.
*
* @return string|bool
* The entity source language or FALSE if no source language was found.
*/
protected function getEntityTranslationSourceLanguage($entity_type, $entity_id) {
try {
return $this->select('entity_translation', 'et')
->fields('et', ['language'])
->condition('entity_type', $entity_type)
->condition('entity_id', $entity_id)
->condition('source', '')
->execute()
->fetchField();
}
// The table might not exist.
catch (\Exception $e) {
return FALSE;
}
}
}
+534 -29
View File
@@ -746,7 +746,7 @@ $connection->insert('blocks')
'throttle' => '0',
'visibility' => '0',
'pages' => '',
'title' => '',
'title' => 'zu - Navigation',
'cache' => '-1',
))
->values(array(
@@ -2716,6 +2716,30 @@ $connection->insert('content_node_field')
'active' => '1',
'locked' => '0',
))
->values(array(
'field_name' => 'field_company_2',
'type' => 'nodereference',
'global_settings' => 'a:1:{s:19:"referenceable_types";a:10:{s:7:"company";s:7:"company";s:7:"article";i:0;s:8:"employee";i:0;s:5:"forum";i:0;s:10:"test_event";i:0;s:9:"test_page";i:0;s:11:"test_planet";i:0;s:10:"test_story";i:0;s:7:"sponsor";i:0;s:5:"story";i:0;}}',
'required' => '0',
'multiple' => '0',
'db_storage' => '1',
'module' => 'nodereference',
'db_columns' => 'a:1:{s:3:"nid";a:4:{s:4:"type";s:3:"int";s:8:"unsigned";b:1;s:8:"not null";b:0;s:5:"index";b:1;}}',
'active' => '1',
'locked' => '0',
))
->values(array(
'field_name' => 'field_company_3',
'type' => 'nodereference',
'global_settings' => 'a:1:{s:19:"referenceable_types";a:10:{s:7:"company";s:7:"company";s:7:"article";i:0;s:8:"employee";i:0;s:5:"forum";i:0;s:10:"test_event";i:0;s:9:"test_page";i:0;s:11:"test_planet";i:0;s:10:"test_story";i:0;s:7:"sponsor";i:0;s:5:"story";i:0;}}',
'required' => '0',
'multiple' => '0',
'db_storage' => '1',
'module' => 'nodereference',
'db_columns' => 'a:1:{s:3:"nid";a:4:{s:4:"type";s:3:"int";s:8:"unsigned";b:1;s:8:"not null";b:0;s:5:"index";b:1;}}',
'active' => '1',
'locked' => '0',
))
->values(array(
'field_name' => 'field_multivalue',
'type' => 'number_decimal',
@@ -2728,6 +2752,30 @@ $connection->insert('content_node_field')
'active' => '1',
'locked' => '0',
))
->values(array(
'field_name' => 'field_reference',
'type' => 'nodereference',
'global_settings' => 'a:1:{s:19:"referenceable_types";a:11:{s:4:"page";s:4:"page";s:7:"article";i:0;s:7:"company";i:0;s:8:"employee";i:0;s:5:"forum";i:0;s:10:"test_event";i:0;s:9:"test_page";i:0;s:11:"test_planet";i:0;s:10:"test_story";i:0;s:7:"sponsor";i:0;s:5:"story";i:0;}}',
'required' => '0',
'multiple' => '0',
'db_storage' => '1',
'module' => 'nodereference',
'db_columns' => 'a:1:{s:3:"nid";a:4:{s:4:"type";s:3:"int";s:8:"unsigned";b:1;s:8:"not null";b:0;s:5:"index";b:1;}}',
'active' => '1',
'locked' => '0',
))
->values(array(
'field_name' => 'field_reference_2',
'type' => 'nodereference',
'global_settings' => 'a:1:{s:19:"referenceable_types";a:11:{s:4:"page";s:4:"page";s:7:"article";i:0;s:7:"company";i:0;s:8:"employee";i:0;s:5:"forum";i:0;s:10:"test_event";i:0;s:9:"test_page";i:0;s:11:"test_planet";i:0;s:10:"test_story";i:0;s:7:"sponsor";i:0;s:5:"story";i:0;}}',
'required' => '0',
'multiple' => '0',
'db_storage' => '1',
'module' => 'nodereference',
'db_columns' => 'a:1:{s:3:"nid";a:4:{s:4:"type";s:3:"int";s:8:"unsigned";b:1;s:8:"not null";b:0;s:5:"index";b:1;}}',
'active' => '1',
'locked' => '0',
))
->values(array(
'field_name' => 'field_test',
'type' => 'text',
@@ -3074,6 +3122,30 @@ $connection->insert('content_node_field_instance')
'widget_module' => 'nodereference',
'widget_active' => '1',
))
->values(array(
'field_name' => 'field_company_2',
'type_name' => 'employee',
'weight' => '33',
'label' => 'Company 2',
'widget_type' => 'nodereference_buttons',
'widget_settings' => 'a:4:{s:18:"autocomplete_match";s:8:"contains";s:4:"size";i:60;s:13:"default_value";a:1:{i:0;a:1:{s:3:"nid";s:0:"";}}s:17:"default_value_php";N;}',
'display_settings' => 'a:5:{s:5:"label";a:2:{s:6:"format";s:5:"above";s:7:"exclude";i:0;}i:5;a:2:{s:6:"format";s:7:"default";s:7:"exclude";i:0;}s:6:"teaser";a:2:{s:6:"format";s:7:"default";s:7:"exclude";i:0;}s:4:"full";a:2:{s:6:"format";s:7:"default";s:7:"exclude";i:0;}i:4;a:2:{s:6:"format";s:7:"default";s:7:"exclude";i:0;}}',
'description' => '',
'widget_module' => 'nodereference',
'widget_active' => '1',
))
->values(array(
'field_name' => 'field_company_3',
'type_name' => 'employee',
'weight' => '34',
'label' => 'Company 3',
'widget_type' => 'nodereference_autocomplete',
'widget_settings' => 'a:4:{s:18:"autocomplete_match";s:8:"contains";s:4:"size";s:2:"60";s:13:"default_value";a:1:{i:0;a:2:{s:3:"nid";N;s:14:"_error_element";s:50:"default_value_widget][field_company_3][0][nid][nid";}}s:17:"default_value_php";N;}',
'display_settings' => 'a:5:{s:5:"label";a:2:{s:6:"format";s:5:"above";s:7:"exclude";i:0;}i:5;a:2:{s:6:"format";s:7:"default";s:7:"exclude";i:0;}s:6:"teaser";a:2:{s:6:"format";s:7:"default";s:7:"exclude";i:0;}s:4:"full";a:2:{s:6:"format";s:7:"default";s:7:"exclude";i:0;}i:4;a:2:{s:6:"format";s:7:"default";s:7:"exclude";i:0;}}',
'description' => '',
'widget_module' => 'nodereference',
'widget_active' => '1',
))
->values(array(
'field_name' => 'field_multivalue',
'type_name' => 'test_planet',
@@ -3086,6 +3158,30 @@ $connection->insert('content_node_field_instance')
'widget_module' => 'number',
'widget_active' => '1',
))
->values(array(
'field_name' => 'field_reference',
'type_name' => 'page',
'weight' => '31',
'label' => 'Reference',
'widget_type' => 'nodereference_select',
'widget_settings' => 'a:4:{s:18:"autocomplete_match";s:8:"contains";s:4:"size";i:60;s:13:"default_value";a:1:{i:0;a:1:{s:3:"nid";s:0:"";}}s:17:"default_value_php";N;}',
'display_settings' => 'a:5:{s:5:"label";a:2:{s:6:"format";s:5:"above";s:7:"exclude";i:0;}i:5;a:2:{s:6:"format";s:7:"default";s:7:"exclude";i:0;}s:6:"teaser";a:2:{s:6:"format";s:7:"default";s:7:"exclude";i:0;}s:4:"full";a:2:{s:6:"format";s:7:"default";s:7:"exclude";i:0;}i:4;a:2:{s:6:"format";s:7:"default";s:7:"exclude";i:0;}}',
'description' => '',
'widget_module' => 'nodereference',
'widget_active' => '1',
))
->values(array(
'field_name' => 'field_reference_2',
'type_name' => 'page',
'weight' => '32',
'label' => 'Reference',
'widget_type' => 'nodereference_select',
'widget_settings' => 'a:4:{s:18:"autocomplete_match";s:8:"contains";s:4:"size";i:60;s:13:"default_value";a:1:{i:0;a:1:{s:3:"nid";s:0:"";}}s:17:"default_value_php";N;}',
'display_settings' => 'a:5:{s:5:"label";a:2:{s:6:"format";s:5:"above";s:7:"exclude";i:0;}i:5;a:2:{s:6:"format";s:7:"default";s:7:"exclude";i:0;}s:6:"teaser";a:2:{s:6:"format";s:7:"default";s:7:"exclude";i:0;}s:4:"full";a:2:{s:6:"format";s:7:"default";s:7:"exclude";i:0;}i:4;a:2:{s:6:"format";s:7:"default";s:7:"exclude";i:0;}}',
'description' => '',
'widget_module' => 'nodereference',
'widget_active' => '1',
))
->values(array(
'field_name' => 'field_test',
'type_name' => 'story',
@@ -3374,6 +3470,18 @@ $connection->schema()->createTable('content_type_employee', array(
'size' => 'normal',
'unsigned' => TRUE,
),
'field_company_2_nid' => array(
'type' => 'int',
'not null' => FALSE,
'size' => 'normal',
'unsigned' => TRUE,
),
'field_company_3_nid' => array(
'type' => 'int',
'not null' => FALSE,
'size' => 'normal',
'unsigned' => TRUE,
),
),
'primary key' => array(
'vid',
@@ -3385,6 +3493,12 @@ $connection->schema()->createTable('content_type_employee', array(
'field_commander_uid' => array(
'field_commander_uid',
),
'field_company_2_nid' => array(
'field_company_2_nid',
),
'field_company_3_nid' => array(
'field_company_3_nid',
),
),
'mysql_character_set' => 'utf8',
));
@@ -3394,11 +3508,15 @@ $connection->insert('content_type_employee')
'vid',
'nid',
'field_commander_uid',
'field_company_2_nid',
'field_company_3_nid',
))
->values(array(
'vid' => '21',
'nid' => '18',
'field_commander_uid' => '8',
'field_company_2_nid' => '15',
'field_company_3_nid' => '16',
))
->execute();
@@ -3423,13 +3541,71 @@ $connection->schema()->createTable('content_type_page', array(
'not null' => FALSE,
'size' => 'normal',
),
'field_reference_nid' => array(
'type' => 'int',
'not null' => FALSE,
'size' => 'normal',
'unsigned' => TRUE,
),
'field_reference_2_nid' => array(
'type' => 'int',
'not null' => FALSE,
'size' => 'normal',
'unsigned' => TRUE,
),
),
'primary key' => array(
'vid',
),
'indexes' => array(
'field_reference_nid' => array(
'field_reference_nid',
),
'field_reference_2_nid' => array(
'field_reference_2_nid',
),
),
'mysql_character_set' => 'utf8',
));
$connection->insert('content_type_page')
->fields(array(
'vid',
'nid',
'field_text_field_value',
'field_reference_nid',
'field_reference_2_nid',
))
->values(array(
'vid' => '13',
'nid' => '10',
'field_text_field_value' => NULL,
'field_reference_nid' => '13',
'field_reference_2_nid' => '13',
))
->values(array(
'vid' => '14',
'nid' => '11',
'field_text_field_value' => NULL,
'field_reference_nid' => '20',
'field_reference_2_nid' => '20',
))
->values(array(
'vid' => '16',
'nid' => '13',
'field_text_field_value' => NULL,
'field_reference_nid' => '10',
'field_reference_2_nid' => '10',
))
->values(array(
'vid' => '23',
'nid' => '20',
'field_text_field_value' => NULL,
'field_reference_nid' => '11',
'field_reference_2_nid' => '11',
))
->execute();
$connection->schema()->createTable('content_type_story', array(
'fields' => array(
'nid' => array(
@@ -8530,6 +8706,30 @@ $connection->schema()->createTable('i18n_blocks', array(
'mysql_character_set' => 'utf8',
));
$connection->insert('i18n_blocks')
->fields(array(
'ibid',
'module',
'delta',
'type',
'language',
))
->values(array(
'ibid' => '1',
'module' => 'user',
'delta' => '1',
'type' => '0',
'language' => 'zu',
))
->values(array(
'ibid' => '2',
'module' => 'menu',
'delta' => 'menu-translation-test',
'type' => '0',
'language' => 'zu',
))
->execute();
$connection->schema()->createTable('i18n_strings', array(
'fields' => array(
'lid' => array(
@@ -8626,7 +8826,7 @@ $connection->insert('i18n_strings')
))
->values(array(
'lid' => '509',
'objectid' => 'profile_sell_address',
'objectid' => 'profile_sell_Address',
'type' => 'field',
'property' => 'title',
'objectindex' => '0',
@@ -8634,7 +8834,7 @@ $connection->insert('i18n_strings')
))
->values(array(
'lid' => '510',
'objectid' => 'profile_sell_address',
'objectid' => 'profile_sell_Address',
'type' => 'field',
'property' => 'explanation',
'objectindex' => '0',
@@ -8714,7 +8914,7 @@ $connection->insert('i18n_strings')
))
->values(array(
'lid' => '520',
'objectid' => 'profile_love_migrations',
'objectid' => 'profile_really_really_love_migrations',
'type' => 'field',
'property' => 'title',
'objectindex' => '0',
@@ -8722,7 +8922,7 @@ $connection->insert('i18n_strings')
))
->values(array(
'lid' => '521',
'objectid' => 'profile_love_migrations',
'objectid' => 'profile_really_really_love_migrations',
'type' => 'field',
'property' => 'explanation',
'objectindex' => '0',
@@ -9640,6 +9840,54 @@ $connection->insert('i18n_strings')
'objectindex' => '7',
'format' => '0',
))
->values(array(
'lid' => '1674',
'objectid' => '463',
'type' => 'item',
'property' => 'title',
'objectindex' => '463',
'format' => '0',
))
->values(array(
'lid' => '1675',
'objectid' => '463',
'type' => 'item',
'property' => 'description',
'objectindex' => '463',
'format' => '0',
))
->values(array(
'lid' => '1676',
'objectid' => '138',
'type' => 'item',
'property' => 'title',
'objectindex' => '138',
'format' => '0',
))
->values(array(
'lid' => '1677',
'objectid' => '138',
'type' => 'item',
'property' => 'description',
'objectindex' => '138',
'format' => '0',
))
->values(array(
'lid' => '1678',
'objectid' => 'profile_really_really_love_migrating',
'type' => 'field',
'property' => 'title',
'objectindex' => '0',
'format' => '0',
))
->values(array(
'lid' => '1679',
'objectid' => 'menu-translation-test',
'type' => 'menu',
'property' => 'title',
'objectindex' => '0',
'format' => '0',
))
->execute();
$connection->schema()->createTable('i18n_variable', array(
@@ -13960,14 +14208,14 @@ $connection->insert('locales_source')
))
->values(array(
'lid' => '509',
'location' => 'field:profile_sell_address:title',
'location' => 'field:profile_sell_Address:title',
'textgroup' => 'profile',
'source' => 'Sell your email address?',
'version' => '1',
))
->values(array(
'lid' => '510',
'location' => 'field:profile_sell_address:explanation',
'location' => 'field:profile_sell_Address:explanation',
'textgroup' => 'profile',
'source' => "If you check this box, we'll sell your address to spammers to help line the pockets of our shareholders. Thanks!",
'version' => '1',
@@ -14037,14 +14285,14 @@ $connection->insert('locales_source')
))
->values(array(
'lid' => '520',
'location' => 'field:profile_love_migrations:title',
'location' => 'field:profile_really_really_love_migrations:title',
'textgroup' => 'profile',
'source' => 'I love migrations',
'source' => 'I really, really, really love migrations',
'version' => '1',
))
->values(array(
'lid' => '521',
'location' => 'field:profile_love_migrations:explanation',
'location' => 'field:profile_really_really_love_migrations:explanation',
'textgroup' => 'profile',
'source' => 'If you check this box, you love migrations.',
'version' => '1',
@@ -22106,6 +22354,48 @@ $connection->insert('locales_source')
'source' => 'Forums',
'version' => '1',
))
->values(array(
'lid' => '1674',
'location' => 'item:463:title',
'textgroup' => 'menu',
'source' => 'fr - Test 1',
'version' => '1',
))
->values(array(
'lid' => '1675',
'location' => 'item:463:description',
'textgroup' => 'menu',
'source' => 'fr - Test menu link 1',
'version' => '1',
))
->values(array(
'lid' => '1676',
'location' => 'item:138:title',
'textgroup' => 'menu',
'source' => 'Test 1',
'version' => '1',
))
->values(array(
'lid' => '1677',
'location' => 'item:138:description',
'textgroup' => 'menu',
'source' => 'Test menu link 1',
'version' => '1',
))
->values(array(
'lid' => '1678',
'location' => 'field:profile_really_really_love_migrating:title',
'textgroup' => 'profile',
'source' => 'I really, really, really love migrating',
'version' => '1',
))
->values(array(
'lid' => '1679',
'location' => 'menu:menu-translation-test:title',
'textgroup' => 'menu',
'source' => 'Translation test',
'version' => '1',
))
->execute();
$connection->schema()->createTable('locales_target', array(
@@ -26284,7 +26574,7 @@ $connection->insert('locales_target')
'language' => 'fr',
'plid' => '0',
'plural' => '0',
'i18n_status' => '0',
'i18n_status' => '1',
))
->values(array(
'lid' => '521',
@@ -27150,6 +27440,14 @@ $connection->insert('locales_target')
'plural' => '0',
'i18n_status' => '0',
))
->values(array(
'lid' => '1678',
'translation' => 'fr - I really, really, really love migrating ',
'language' => 'fr',
'plid' => '0',
'plural' => '0',
'i18n_status' => '0',
))
->values(array(
'lid' => '66',
'translation' => 'zu - CCK - Aucune Intégration aux Vues',
@@ -27635,7 +27933,7 @@ $connection->insert('menu_links')
'link_path' => 'user/login',
'router_path' => 'user/login',
'link_title' => 'Test 1',
'options' => 'a:1:{s:10:"attributes";a:1:{s:5:"title";s:16:"Test menu link 1";}}',
'options' => 'a:2:{s:10:"attributes";a:1:{s:5:"title";s:16:"Test menu link 1";}s:8:"langcode";s:2:"en";}',
'module' => 'menu',
'hidden' => '0',
'external' => '0',
@@ -33649,6 +33947,141 @@ $connection->insert('menu_links')
'p9' => '0',
'updated' => '0',
))
->values(array(
'menu_name' => 'primary-links',
'mlid' => '459',
'plid' => '0',
'link_path' => 'node/10',
'router_path' => 'node/%',
'link_title' => 'The Real McCoy',
'options' => 'a:2:{s:10:"attributes";a:1:{s:5:"title";s:0:"";}s:5:"alter";b:1;}',
'module' => 'menu',
'hidden' => '0',
'external' => '0',
'has_children' => '0',
'expanded' => '0',
'weight' => '0',
'depth' => '1',
'customized' => '1',
'p1' => '459',
'p2' => '0',
'p3' => '0',
'p4' => '0',
'p5' => '0',
'p6' => '0',
'p7' => '0',
'p8' => '0',
'p9' => '0',
'updated' => '0',
))
->values(array(
'menu_name' => 'primary-links',
'mlid' => '460',
'plid' => '0',
'link_path' => 'node/11',
'router_path' => 'node/%',
'link_title' => 'Le Vrai McCoy',
'options' => 'a:2:{s:10:"attributes";a:1:{s:5:"title";s:0:"";}s:5:"alter";b:1;}',
'module' => 'menu',
'hidden' => '0',
'external' => '0',
'has_children' => '0',
'expanded' => '0',
'weight' => '0',
'depth' => '1',
'customized' => '1',
'p1' => '460',
'p2' => '0',
'p3' => '0',
'p4' => '0',
'p5' => '0',
'p6' => '0',
'p7' => '0',
'p8' => '0',
'p9' => '0',
'updated' => '0',
))
->values(array(
'menu_name' => 'primary-links',
'mlid' => '461',
'plid' => '0',
'link_path' => 'node/12',
'router_path' => 'node/%',
'link_title' => 'Abantu zulu',
'options' => 'a:2:{s:10:"attributes";a:1:{s:5:"title";s:0:"";}s:5:"alter";b:1;}',
'module' => 'menu',
'hidden' => '0',
'external' => '0',
'has_children' => '0',
'expanded' => '0',
'weight' => '0',
'depth' => '1',
'customized' => '1',
'p1' => '461',
'p2' => '0',
'p3' => '0',
'p4' => '0',
'p5' => '0',
'p6' => '0',
'p7' => '0',
'p8' => '0',
'p9' => '0',
'updated' => '0',
))
->values(array(
'menu_name' => 'primary-links',
'mlid' => '462',
'plid' => '0',
'link_path' => 'node/13',
'router_path' => 'node/%',
'link_title' => 'The Zulu People',
'options' => 'a:2:{s:10:"attributes";a:1:{s:5:"title";s:0:"";}s:5:"alter";b:1;}',
'module' => 'menu',
'hidden' => '0',
'external' => '0',
'has_children' => '0',
'expanded' => '0',
'weight' => '0',
'depth' => '1',
'customized' => '1',
'p1' => '462',
'p2' => '0',
'p3' => '0',
'p4' => '0',
'p5' => '0',
'p6' => '0',
'p7' => '0',
'p8' => '0',
'p9' => '0',
'updated' => '0',
))
->values(array(
'menu_name' => 'secondary-links',
'mlid' => '463',
'plid' => '139',
'link_path' => 'user/login',
'router_path' => 'user/login',
'link_title' => 'fr - Test 1',
'options' => 'a:3:{s:10:"attributes";a:1:{s:5:"title";s:21:"fr - Test menu link 1";}s:8:"langcode";s:2:"fr";s:5:"alter";b:1;}',
'module' => 'menu',
'hidden' => '0',
'external' => '0',
'has_children' => '0',
'expanded' => '0',
'weight' => '-49',
'depth' => '2',
'customized' => '1',
'p1' => '139',
'p2' => '459',
'p3' => '0',
'p4' => '0',
'p5' => '0',
'p6' => '0',
'p7' => '0',
'p8' => '0',
'p9' => '0',
'updated' => '0',
))
->execute();
$connection->schema()->createTable('menu_router', array(
@@ -43283,6 +43716,23 @@ $connection->insert('node')
'tnid' => '0',
'translate' => '0',
))
->values(array(
'nid' => '20',
'vid' => '23',
'type' => 'page',
'language' => 'fr',
'title' => 'Le peuple zoulou',
'uid' => '1',
'status' => '1',
'created' => '1520613038',
'changed' => '1520613305',
'comment' => '0',
'promote' => '1',
'moderate' => '0',
'sticky' => '0',
'tnid' => '12',
'translate' => '0',
))
->execute();
$connection->schema()->createTable('node_access', array(
@@ -43564,6 +44014,30 @@ $connection->insert('node_counter')
'daycount' => '1',
'timestamp' => '1478755314',
))
->values(array(
'nid' => '10',
'totalcount' => '5',
'daycount' => '1',
'timestamp' => '1521137459',
))
->values(array(
'nid' => '11',
'totalcount' => '3',
'daycount' => '1',
'timestamp' => '1521137463',
))
->values(array(
'nid' => '12',
'totalcount' => '3',
'daycount' => '0',
'timestamp' => '1521137469',
))
->values(array(
'nid' => '13',
'totalcount' => '2',
'daycount' => '1',
'timestamp' => '1521137470',
))
->values(array(
'nid' => '14',
'totalcount' => '1',
@@ -43686,17 +44160,6 @@ $connection->insert('node_revisions')
'timestamp' => '1420861423',
'format' => '1',
))
->values(array(
'nid' => '1',
'vid' => '2',
'uid' => '2',
'title' => 'Test title rev 2',
'body' => 'body test rev 2',
'teaser' => 'teaser test rev 2',
'log' => 'modified rev 2',
'timestamp' => '1390095702',
'format' => '1',
))
->values(array(
'nid' => '2',
'vid' => '3',
@@ -43917,6 +44380,28 @@ $connection->insert('node_revisions')
'timestamp' => '1501955771',
'format' => '1',
))
->values(array(
'nid' => '20',
'vid' => '23',
'uid' => '1',
'title' => 'Le peuple zoulou',
'body' => 'Le peuple zoulou.',
'teaser' => 'Le peuple zoulou.',
'log' => '',
'timestamp' => '1520613305',
'format' => '1',
))
->values(array(
'nid' => '1',
'vid' => '2001',
'uid' => '2',
'title' => 'Test title rev 2',
'body' => 'body test rev 2',
'teaser' => 'teaser test rev 2',
'log' => 'modified rev 2',
'timestamp' => '1390095702',
'format' => '1',
))
->execute();
$connection->schema()->createTable('node_type', array(
@@ -44183,7 +44668,7 @@ $connection->insert('node_type')
'custom' => '1',
'modified' => '1',
'locked' => '0',
'orig_type' => 'page',
'orig_type' => 'test_page',
))
->values(array(
'type' => 'test_planet',
@@ -44414,7 +44899,7 @@ $connection->insert('profile_fields')
->values(array(
'fid' => '10',
'title' => 'Sell your email address?',
'name' => 'profile_sell_address',
'name' => 'profile_sell_Address',
'explanation' => "If you check this box, we'll sell your address to spammers to help line the pockets of our shareholders. Thanks!",
'category' => 'Communication preferences',
'page' => 'People who want us to sell their address',
@@ -44488,8 +44973,8 @@ $connection->insert('profile_fields')
))
->values(array(
'fid' => '15',
'title' => 'I love migrations',
'name' => 'profile_love_migrations',
'title' => 'I really, really, really love migrations',
'name' => 'profile_really_really_love_migrations',
'explanation' => 'If you check this box, you love migrations.',
'category' => 'Personal information',
'page' => 'People who love migrations',
@@ -44501,6 +44986,21 @@ $connection->insert('profile_fields')
'autocomplete' => '0',
'options' => '',
))
->values(array(
'fid' => '16',
'title' => 'I really, really, really love migrating',
'name' => 'profile_really_really_love_migrating',
'explanation' => '',
'category' => 'Personal information',
'page' => '',
'type' => 'checkbox',
'weight' => '0',
'required' => '0',
'register' => '0',
'visibility' => '2',
'autocomplete' => '0',
'options' => '',
))
->execute();
$connection->schema()->createTable('profile_values', array(
@@ -44713,6 +45213,11 @@ $connection->insert('profile_values')
'uid' => '17',
'value' => 'a:3:{s:5:"month";s:2:"12";s:3:"day";s:2:"18";s:4:"year";s:4:"1942";}',
))
->values(array(
'fid' => '15',
'uid' => '2',
'value' => '1',
))
->execute();
$connection->schema()->createTable('role', array(
@@ -46330,12 +46835,12 @@ $connection->insert('term_node')
))
->values(array(
'nid' => '1',
'vid' => '2',
'vid' => '2001',
'tid' => '4',
))
->values(array(
'nid' => '1',
'vid' => '2',
'vid' => '2001',
'tid' => '5',
))
->values(array(
File diff suppressed because it is too large Load Diff
@@ -7,6 +7,7 @@ use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
/**
* @group migrate_drupal
* @group legacy
*/
class CckFieldBackwardsCompatibilityTest extends MigrateDrupal6TestBase {
@@ -17,6 +18,8 @@ class CckFieldBackwardsCompatibilityTest extends MigrateDrupal6TestBase {
/**
* Ensures that the cckfield backwards compatibility layer is invoked.
*
* @expectedDeprecation MigrateCckFieldInterface is deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.x. Use \Drupal\migrate_drupal\Annotation\MigrateField instead.
*/
public function testBackwardsCompatibility() {
$migration = $this->container
@@ -3,6 +3,7 @@
namespace Drupal\Tests\migrate_drupal\Kernel\Plugin\migrate;
use Drupal\ban\Plugin\migrate\destination\BlockedIP;
use Drupal\color\Plugin\migrate\destination\Color;
use Drupal\KernelTests\FileSystemModuleDiscoveryDataProviderTrait;
use Drupal\migrate\Plugin\migrate\destination\ComponentEntityDisplayBase;
use Drupal\migrate\Plugin\migrate\destination\Config;
@@ -98,6 +99,7 @@ class DestinationCategoryTest extends MigrateDrupalTestBase {
*/
protected function getConfigurationClasses() {
return [
Color::class,
Config::class,
EntityConfigBase::class,
ThemeSettings::class,
@@ -16,7 +16,7 @@ use Drupal\node\Entity\Node;
use Drupal\node\Entity\NodeType;
use Drupal\taxonomy\Entity\Term;
use Drupal\taxonomy\Entity\Vocabulary;
use Drupal\Tests\media\Functional\MediaFunctionalTestCreateMediaTypeTrait;
use Drupal\Tests\media\Traits\MediaTypeCreationTrait;
use Drupal\user\Entity\User;
/**
@@ -27,7 +27,7 @@ use Drupal\user\Entity\User;
class ContentEntityTest extends KernelTestBase {
use EntityReferenceTestTrait;
use MediaFunctionalTestCreateMediaTypeTrait;
use MediaTypeCreationTrait;
/**
* {@inheritdoc}
@@ -244,7 +244,7 @@ class ContentEntityTest extends KernelTestBase {
];
$migration = $this->migrationPluginManager->createStubMigration($this->migrationDefinition('content_entity:user'));
$user_source = $this->sourcePluginManager->createInstance('content_entity:user', $configuration, $migration);
$this->assertSame('user entities', $user_source->__toString());
$this->assertSame('users', $user_source->__toString());
$this->assertEquals(1, $user_source->count());
$ids = $user_source->getIds();
$this->assertArrayHasKey('langcode', $ids);
@@ -279,7 +279,7 @@ class ContentEntityTest extends KernelTestBase {
];
$migration = $this->migrationPluginManager->createStubMigration($this->migrationDefinition('content_entity:file'));
$file_source = $this->sourcePluginManager->createInstance('content_entity:file', $configuration, $migration);
$this->assertSame('file entities', $file_source->__toString());
$this->assertSame('files', $file_source->__toString());
$this->assertEquals(1, $file_source->count());
$ids = $file_source->getIds();
$this->assertArrayHasKey('fid', $ids);
@@ -339,12 +339,11 @@ class ContentEntityTest extends KernelTestBase {
public function testMediaSource() {
$values = [
'id' => 'image',
'bundle' => 'image',
'label' => 'Image',
'source' => 'test',
'new_revision' => FALSE,
];
$media_type = $this->createMediaType($values);
$media_type = $this->createMediaType('test', $values);
$media = Media::create([
'name' => 'Foo media',
'uid' => $this->user->id(),
@@ -395,7 +394,7 @@ class ContentEntityTest extends KernelTestBase {
];
$migration = $this->migrationPluginManager->createStubMigration($this->migrationDefinition('content_entity:taxonomy_term'));
$term_source = $this->sourcePluginManager->createInstance('content_entity:taxonomy_term', $configuration, $migration);
$this->assertSame('taxonomy term entities', $term_source->__toString());
$this->assertSame('taxonomy terms', $term_source->__toString());
$this->assertEquals(2, $term_source->count());
$ids = $term_source->getIds();
$this->assertArrayHasKey('langcode', $ids);
@@ -72,7 +72,7 @@ class ConfigTest extends MigrateSqlSourceTestBase {
],
'collections' => [
'language.af',
]
],
];
// Test with name and no collection in configuration.
@@ -115,7 +115,7 @@ class EntityContentBaseTest extends MigrateDrupal6TestBase {
// Match the expected message. Can't use default argument types, because
// we need to convert to string from TranslatableMarkup.
$argument = Argument::that(function ($msg) {
return strpos((string) $msg, "This entity type does not support translation") !== FALSE;
return strpos((string) $msg, htmlentities('The "no_language_entity_test" entity type does not support translations.')) !== FALSE;
});
$message->display($argument, Argument::any())
->shouldBeCalled();
@@ -0,0 +1,80 @@
<?php
namespace Drupal\Tests\migrate_drupal\Kernel\d6;
use Drupal\node\Entity\Node;
use Drupal\Tests\node\Kernel\Migrate\d6\MigrateNodeTestBase;
/**
* Tests follow-up migrations.
*
* @group migrate_drupal
*/
class FollowUpMigrationsTest extends MigrateNodeTestBase {
/**
* {@inheritdoc}
*/
public static $modules = [
'content_translation',
'language',
'menu_ui',
// A requirement for d6_node_translation.
'migrate_drupal_multilingual',
];
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->executeMigrations([
'language',
'd6_language_content_settings',
'd6_node',
'd6_node_translation',
]);
}
/**
* Test entity reference translations.
*/
public function testEntityReferenceTranslations() {
// Test the entity reference field before the follow-up migrations.
$node = Node::load(10);
$this->assertSame('13', $node->get('field_reference')->target_id);
$this->assertSame('13', $node->get('field_reference_2')->target_id);
$translation = $node->getTranslation('fr');
$this->assertSame('20', $translation->get('field_reference')->target_id);
$this->assertSame('20', $translation->get('field_reference_2')->target_id);
$node = Node::load(12)->getTranslation('en');
$this->assertSame('10', $node->get('field_reference')->target_id);
$this->assertSame('10', $node->get('field_reference_2')->target_id);
$translation = $node->getTranslation('fr');
$this->assertSame('11', $translation->get('field_reference')->target_id);
$this->assertSame('11', $translation->get('field_reference_2')->target_id);
// Run the follow-up migrations.
$migration_plugin_manager = $this->container->get('plugin.manager.migration');
$migration_plugin_manager->clearCachedDefinitions();
$follow_up_migrations = $migration_plugin_manager->createInstances('d6_entity_reference_translation');
$this->executeMigrations(array_keys($follow_up_migrations));
// Test the entity reference field after the follow-up migrations.
$node = Node::load(10);
$this->assertSame('12', $node->get('field_reference')->target_id);
$this->assertSame('12', $node->get('field_reference_2')->target_id);
$translation = $node->getTranslation('fr');
$this->assertSame('12', $translation->get('field_reference')->target_id);
$this->assertSame('12', $translation->get('field_reference_2')->target_id);
$node = Node::load(12)->getTranslation('en');
$this->assertSame('10', $node->get('field_reference')->target_id);
$this->assertSame('10', $node->get('field_reference_2')->target_id);
$translation = $node->getTranslation('fr');
$this->assertSame('10', $translation->get('field_reference')->target_id);
$this->assertSame('10', $translation->get('field_reference_2')->target_id);
}
}
@@ -7,8 +7,8 @@ use Drupal\migrate\Audit\AuditResult;
use Drupal\migrate\Audit\IdAuditor;
use Drupal\node\Entity\Node;
use Drupal\node\Entity\NodeType;
use Drupal\Tests\content_moderation\Traits\ContentModerationTestTrait;
use Drupal\Tests\migrate_drupal\Traits\CreateTestContentEntitiesTrait;
use Drupal\workflows\Entity\Workflow;
/**
* Tests the migration auditor for ID conflicts.
@@ -19,6 +19,7 @@ class MigrateDrupal6AuditIdsTest extends MigrateDrupal6TestBase {
use FileSystemModuleDiscoveryDataProviderTrait;
use CreateTestContentEntitiesTrait;
use ContentModerationTestTrait;
/**
* {@inheritdoc}
@@ -44,7 +45,7 @@ class MigrateDrupal6AuditIdsTest extends MigrateDrupal6TestBase {
$this->installEntitySchema('content_moderation_state');
$this->installConfig('content_moderation');
NodeType::create(['type' => 'page'])->save();
$workflow = Workflow::load('editorial');
$workflow = $this->createEditorialWorkflow();
$workflow->getTypePlugin()->addEntityTypeAndBundle('node', 'page');
$workflow->save();
}
@@ -60,8 +61,9 @@ class MigrateDrupal6AuditIdsTest extends MigrateDrupal6TestBase {
// Insert data in the d6_node:page migration mappping table to simulate a
// previously migrated node.
$table_name = $this->getMigration('d6_node:page')->getIdMap()->mapTableName();
$this->container->get('database')->insert($table_name)
$id_map = $this->getMigration('d6_node:page')->getIdMap();
$table_name = $id_map->mapTableName();
$id_map->getDatabase()->insert($table_name)
->fields([
'source_ids_hash' => 1,
'sourceid1' => 1,
@@ -137,6 +139,7 @@ class MigrateDrupal6AuditIdsTest extends MigrateDrupal6TestBase {
'd6_taxonomy_term',
'd6_term_node_revision',
'd6_user',
'node_translation_menu_links',
];
$this->assertEmpty(array_diff(array_filter($conflicts), $expected));
}
@@ -157,8 +160,9 @@ class MigrateDrupal6AuditIdsTest extends MigrateDrupal6TestBase {
// Insert data in the d6_node_revision:page migration mappping table to
// simulate a previously migrated node revison.
$table_name = $this->getMigration('d6_node_revision:page')->getIdMap()->mapTableName();
$this->container->get('database')->insert($table_name)
$id_map = $this->getMigration('d6_node_revision:page')->getIdMap();
$table_name = $id_map->mapTableName();
$id_map->getDatabase()->insert($table_name)
->fields([
'source_ids_hash' => 1,
'sourceid1' => 1,
@@ -0,0 +1,119 @@
<?php
namespace Drupal\Tests\migrate_drupal\Kernel\d7;
use Drupal\node\Entity\Node;
use Drupal\Tests\file\Kernel\Migrate\d7\FileMigrationSetupTrait;
/**
* Tests follow-up migrations.
*
* @group migrate_drupal
*/
class FollowUpMigrationsTest extends MigrateDrupal7TestBase {
use FileMigrationSetupTrait;
/**
* {@inheritdoc}
*/
public static $modules = [
'content_translation',
'comment',
'datetime',
'file',
'image',
'language',
'link',
'menu_ui',
// A requirement for translation migrations.
'migrate_drupal_multilingual',
'node',
'taxonomy',
'telephone',
'text',
];
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->fileMigrationSetup();
$this->installEntitySchema('node');
$this->installEntitySchema('comment');
$this->installEntitySchema('taxonomy_term');
$this->installConfig(static::$modules);
$this->installSchema('node', ['node_access']);
$this->executeMigrations([
'language',
'd7_user_role',
'd7_user',
'd7_node_type',
'd7_language_content_settings',
'd7_comment_type',
'd7_taxonomy_vocabulary',
'd7_field',
'd7_field_instance',
'd7_node',
'd7_node_translation',
]);
}
/**
* {@inheritdoc}
*/
protected function getFileMigrationInfo() {
return [
'path' => 'public://sites/default/files/cube.jpeg',
'size' => '3620',
'base_path' => 'public://',
'plugin_id' => 'd7_file',
];
}
/**
* Test entity reference translations.
*/
public function testEntityReferenceTranslations() {
// Test the entity reference field before the follow-up migrations.
$node = Node::load(2);
$this->assertSame('5', $node->get('field_reference')->target_id);
$this->assertSame('5', $node->get('field_reference_2')->target_id);
$translation = $node->getTranslation('is');
$this->assertSame('4', $translation->get('field_reference')->target_id);
$this->assertSame('4', $translation->get('field_reference_2')->target_id);
$node = Node::load(4);
$this->assertSame('3', $node->get('field_reference')->target_id);
$this->assertSame('3', $node->get('field_reference_2')->target_id);
$translation = $node->getTranslation('en');
$this->assertSame('2', $translation->get('field_reference')->target_id);
$this->assertSame('2', $translation->get('field_reference_2')->target_id);
// Run the follow-up migrations.
$migration_plugin_manager = $this->container->get('plugin.manager.migration');
$migration_plugin_manager->clearCachedDefinitions();
$follow_up_migrations = $migration_plugin_manager->createInstances('d7_entity_reference_translation');
$this->executeMigrations(array_keys($follow_up_migrations));
// Test the entity reference field after the follow-up migrations.
$node = Node::load(2);
$this->assertSame('4', $node->get('field_reference')->target_id);
$this->assertSame('4', $node->get('field_reference_2')->target_id);
$translation = $node->getTranslation('is');
$this->assertSame('4', $translation->get('field_reference')->target_id);
$this->assertSame('4', $translation->get('field_reference_2')->target_id);
$node = Node::load(4);
$this->assertSame('2', $node->get('field_reference')->target_id);
$this->assertSame('2', $node->get('field_reference_2')->target_id);
$translation = $node->getTranslation('en');
$this->assertSame('2', $translation->get('field_reference')->target_id);
$this->assertSame('2', $translation->get('field_reference_2')->target_id);
}
}
@@ -7,8 +7,8 @@ use Drupal\migrate\Audit\AuditResult;
use Drupal\migrate\Audit\IdAuditor;
use Drupal\node\Entity\Node;
use Drupal\node\Entity\NodeType;
use Drupal\Tests\content_moderation\Traits\ContentModerationTestTrait;
use Drupal\Tests\migrate_drupal\Traits\CreateTestContentEntitiesTrait;
use Drupal\workflows\Entity\Workflow;
/**
* Tests the migration auditor for ID conflicts.
@@ -19,6 +19,7 @@ class MigrateDrupal7AuditIdsTest extends MigrateDrupal7TestBase {
use FileSystemModuleDiscoveryDataProviderTrait;
use CreateTestContentEntitiesTrait;
use ContentModerationTestTrait;
/**
* {@inheritdoc}
@@ -44,7 +45,7 @@ class MigrateDrupal7AuditIdsTest extends MigrateDrupal7TestBase {
$this->installEntitySchema('content_moderation_state');
$this->installConfig('content_moderation');
NodeType::create(['type' => 'page'])->save();
$workflow = Workflow::load('editorial');
$workflow = $this->createEditorialWorkflow();
$workflow->getTypePlugin()->addEntityTypeAndBundle('node', 'page');
$workflow->save();
}
@@ -60,8 +61,9 @@ class MigrateDrupal7AuditIdsTest extends MigrateDrupal7TestBase {
// Insert data in the d7_node:page migration mappping table to simulate a
// previously migrated node.
$table_name = $this->getMigration('d7_node:page')->getIdMap()->mapTableName();
$this->container->get('database')->insert($table_name)
$id_map = $this->getMigration('d7_node:page')->getIdMap();
$table_name = $id_map->mapTableName();
$id_map->getDatabase()->insert($table_name)
->fields([
'source_ids_hash' => 1,
'sourceid1' => 1,
@@ -136,6 +138,7 @@ class MigrateDrupal7AuditIdsTest extends MigrateDrupal7TestBase {
'd7_node_revision',
'd7_taxonomy_term',
'd7_user',
'node_translation_menu_links',
];
$this->assertEmpty(array_diff(array_filter($conflicts), $expected));
}
@@ -156,8 +159,9 @@ class MigrateDrupal7AuditIdsTest extends MigrateDrupal7TestBase {
// Insert data in the d7_node_revision:page migration mappping table to
// simulate a previously migrated node revison.
$table_name = $this->getMigration('d7_node_revision:page')->getIdMap()->mapTableName();
$this->container->get('database')->insert($table_name)
$id_map = $this->getMigration('d7_node_revision:page')->getIdMap();
$table_name = $id_map->mapTableName();
$id_map->getDatabase()->insert($table_name)
->fields([
'source_ids_hash' => 1,
'sourceid1' => 1,
@@ -2,7 +2,7 @@
namespace Drupal\Tests\migrate_drupal\Kernel\dependencies;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\migrate\MigrateExecutable;
use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
@@ -67,7 +67,7 @@ class MigrateDependenciesTest extends MigrateDrupal6TestBase {
$executable = new MigrateExecutable($migration, $this);
$this->startCollectingMessages();
$executable->import();
$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->assertEqual($this->migrateMessages['error'], [new FormattableMarkup('Migration @id did not meet the requirements. Missing migrations d6_aggregator_feed. requirements: d6_aggregator_feed.', ['@id' => $migration->id()])]);
$this->collectMessages = FALSE;
}
@@ -43,7 +43,7 @@ class VariableTranslationTest extends MigrateSqlSourceTestCase {
'language' => 'mi',
'site_slogan' => 'Ko whakamataku heke',
'site_name' => 'ingoa_pae',
]
],
];
/**
@@ -44,7 +44,7 @@ class i18nVariableTest extends MigrateSqlSourceTestCase {
'language' => 'mi',
'site_slogan' => 'Ko whakamataku heke',
'site_name' => 'ingoa_pae',
]
],
];
/**