diff -u b/core/modules/migrate/config/migrate.migration.d6_system_site.yml b/core/modules/migrate/config/migrate.migration.d6_system_site.yml --- b/core/modules/migrate/config/migrate.migration.d6_system_site.yml +++ b/core/modules/migrate/config/migrate.migration.d6_system_site.yml @@ -11,7 +11,6 @@ - drupal_weight_select_max - admin_compact_mode process: - plugin: copy_from_source name: site_name mail: site_mail slogan: site_slogan diff -u b/core/modules/migrate/lib/Drupal/migrate/Entity/Migration.php b/core/modules/migrate/lib/Drupal/migrate/Entity/Migration.php --- b/core/modules/migrate/lib/Drupal/migrate/Entity/Migration.php +++ b/core/modules/migrate/lib/Drupal/migrate/Entity/Migration.php @@ -10,7 +10,6 @@ use Drupal\Core\Config\Entity\ConfigEntityBase; use Drupal\migrate\MigrateException; use Drupal\migrate\Plugin\MigrateIdMapInterface; -use Drupal\migrate\Plugin\MigrateProcessBag; /** * Defines the Migration entity. @@ -95,20 +94,11 @@ /** * The configuration describing the process plugins. * - * Used to initialize $migrateProcessBag. - * * @var array */ public $process; /** - * The array which stores all active process plugins. - * - * @var array - */ - protected $processPlugins = array(); - - /** * The destination configuration, with at least a 'plugin' key. * * Used to initialize $destinationPlugin. @@ -144,7 +134,7 @@ * The source identifiers. * * An array of source identifiers: the keys are the name of the properties, - * the values are dependent on the id map plugin. + * the values are dependent on the ID map plugin. * * @var array */ @@ -154,7 +144,7 @@ * The destination identifiers. * * An array of destination identifiers: the keys are the name of the - * properties, the values are dependent on the id map plugin. + * properties, the values are dependent on the ID map plugin. * * @var array */ @@ -200,7 +190,7 @@ /** * {@inheritdoc} */ - public function getSource() { + public function getSourcePlugin() { if (!isset($this->sourcePlugin)) { $this->sourcePlugin = \Drupal::service('plugin.manager.migrate.source')->createInstance($this->source['plugin'], $this->source, $this); } @@ -210,23 +200,27 @@ /** * {@inheritdoc} */ - public function getProcess() { - foreach ($this->getProcessNormalized() as $property => $configurations) { + public function getProcessPlugins(array $process = NULL) { + if (!isset($process)) { + $process = $this->process; + } + $process_plugins = array(); + foreach ($this->getProcessNormalized($process) as $property => $configurations) { foreach ($configurations as $configuration) { - $this->processPlugins[$property] = array(); + $process_plugins[$property] = array(); if (isset($configuration['source'])) { - $this->processPlugins[$property][] = \Drupal::service('plugin.manager.migrate.process')->createInstance('get', $configuration, $this); + $process_plugins[$property][] = \Drupal::service('plugin.manager.migrate.process')->createInstance('get', $configuration, $this); } // Get is already handled. if ($configuration['plugin'] != 'get') { - $this->processPlugins[$property][] = \Drupal::service('plugin.manager.migrate.process')->createInstance($configuration['plugin'], $configuration, $this); + $process_plugins[$property][] = \Drupal::service('plugin.manager.migrate.process')->createInstance($configuration['plugin'], $configuration, $this); } - if (!$this->processPlugins[$property]) { + if (!$process_plugins[$property]) { throw new MigrateException("Invalid process configuration for $property"); } } } - return $this->processPlugins; + return $process_plugins; } /** @@ -235,9 +229,9 @@ * @return array * The normalized process configuration. */ - protected function getProcessNormalized() { + protected function getProcessNormalized($process) { $normalized_configurations = array(); - foreach ($this->process as $destination => $configuration) { + foreach ($process as $destination => $configuration) { if (is_string($configuration)) { $configuration = array( 'plugin' => 'get', @@ -255,7 +249,7 @@ /** * {@inheritdoc} */ - public function getDestination() { + public function getDestinationPlugin() { if (!isset($this->destinationPlugin)) { $this->destinationPlugin = \Drupal::service('plugin.manager.migrate.destination')->createInstance($this->destination['plugin'], $this->destination, $this); } diff -u b/core/modules/migrate/lib/Drupal/migrate/Entity/MigrationInterface.php b/core/modules/migrate/lib/Drupal/migrate/Entity/MigrationInterface.php --- b/core/modules/migrate/lib/Drupal/migrate/Entity/MigrationInterface.php +++ b/core/modules/migrate/lib/Drupal/migrate/Entity/MigrationInterface.php @@ -55,21 +55,24 @@ * * @return \Drupal\migrate\Plugin\MigrateSourceInterface */ - public function getSource(); + public function getSourcePlugin(); /** * Returns the process plugins. * + * @param array $process + * A process configuration array. * @return array + * A list of process plugins. */ - public function getProcess(); + public function getProcessPlugins(array $process = NULL); /** * Returns the initialized destination plugin. * * @return \Drupal\migrate\Plugin\MigrateDestinationInterface */ - public function getDestination(); + public function getDestinationPlugin(); /** * Returns the initialized id_map plugin. diff -u b/core/modules/migrate/lib/Drupal/migrate/MigrateExecutable.php b/core/modules/migrate/lib/Drupal/migrate/MigrateExecutable.php --- b/core/modules/migrate/lib/Drupal/migrate/MigrateExecutable.php +++ b/core/modules/migrate/lib/Drupal/migrate/MigrateExecutable.php @@ -210,7 +210,7 @@ public function import() { $return = MigrationInterface::RESULT_COMPLETED; $source = $this->getSource(); - $destination = $this->migration->getDestination(); + $destination = $this->migration->getDestinationPlugin(); $id_map = $this->migration->getIdMap(); try { @@ -222,7 +222,7 @@ array('!e' => $e->getMessage()))); return MigrationInterface::RESULT_FAILED; } - while ($this->getSource()->valid()) { + while ($source->valid()) { $row = $source->current(); $this->sourceIdValues = $row->getSourceIdValues(); @@ -234,7 +234,7 @@ try { $destination_id_values = $destination->import($row); - // @TODO handle the successful but no id case like config. + // @TODO handle the successful but no ID case like config. if ($destination_id_values) { $id_map->saveIdMapping($row, $destination_id_values, $this->needsUpdate, $this->rollbackAction); $this->successes_since_feedback++; @@ -302,9 +302,9 @@ /** * Apply transformations to a data row received from the source. */ - protected function processRow(Row $row) { + public function processRow(Row $row, array $process = NULL) { $value = NULL; - foreach ($this->migration->getProcess() as $destination => $plugins) { + foreach ($this->migration->getProcessPlugins($process) as $destination => $plugins) { foreach ($plugins as $plugin) { $value = $plugin->transform($value, $this, $row, $destination); } diff -u b/core/modules/migrate/lib/Drupal/migrate/Plugin/MigrateDestinationInterface.php b/core/modules/migrate/lib/Drupal/migrate/Plugin/MigrateDestinationInterface.php --- b/core/modules/migrate/lib/Drupal/migrate/Plugin/MigrateDestinationInterface.php +++ b/core/modules/migrate/lib/Drupal/migrate/Plugin/MigrateDestinationInterface.php @@ -51,12 +51,12 @@ /** * Derived classes must implement import(), to construct one new object (pre-populated - * using id mappings in the Migration). + * using ID mappings in the Migration). */ public function import(Row $row); /** - * Delete the specified ids from the target Drupal. + * Delete the specified IDs from the target Drupal. * @param array $destination_identifiers */ public function rollbackMultiple(array $destination_identifiers); diff -u b/core/modules/migrate/lib/Drupal/migrate/Plugin/MigrateIdMapInterface.php b/core/modules/migrate/lib/Drupal/migrate/Plugin/MigrateIdMapInterface.php --- b/core/modules/migrate/lib/Drupal/migrate/Plugin/MigrateIdMapInterface.php +++ b/core/modules/migrate/lib/Drupal/migrate/Plugin/MigrateIdMapInterface.php @@ -13,9 +13,9 @@ use Drupal\migrate\Row; /** - * An interface for migrate id mappings. + * An interface for migrate ID mappings. * - * Migrate id mappings maintain a relation between source ID and + * Migrate ID mappings maintain a relation between source ID and * destination ID for audit and rollback purposes. */ interface MigrateIdMapInterface extends PluginInspectionInterface { reverted: --- b/core/modules/migrate/lib/Drupal/migrate/Plugin/MigrateProcessBag.php +++ /dev/null @@ -1,72 +0,0 @@ -migration = $migration; - } - - /** - * {@inheritdoc} - * - * Extends in order to pass the migration entity to the plugin manager. - */ - public function initializePlugin($instance_id) { - $this->configurations[$instance_id] += array('plugin' => 'copy_from_source'); - $configuration = isset($this->configurations[$instance_id]) ? $this->configurations[$instance_id] : array(); - if (!isset($configuration[$this->pluginKey])) { - throw new UnknownPluginException($instance_id); - } - $plugin_key = $configuration[$this->pluginKey]; - unset($configuration[$this->pluginKey]); - $this->pluginInstances[$instance_id] = $this->manager->createInstance($plugin_key, $configuration, $this->migration); - $this->addInstanceID($instance_id); - } - -} diff -u b/core/modules/migrate/lib/Drupal/migrate/Plugin/migrate/source/SourcePluginBase.php b/core/modules/migrate/lib/Drupal/migrate/Plugin/migrate/source/SourcePluginBase.php --- b/core/modules/migrate/lib/Drupal/migrate/Plugin/migrate/source/SourcePluginBase.php +++ b/core/modules/migrate/lib/Drupal/migrate/Plugin/migrate/source/SourcePluginBase.php @@ -47,6 +47,7 @@ */ public function prepareRow(Row $row) { $this->getModuleHandler()->invokeAll('migrate_prepare_row', $row, $this, $this->migration); + $this->getModuleHandler()->invokeAll('migrate_ '. $this->migration->id() . '_prepare_row', $row, $this, $this->migration); return TRUE; } diff -u b/core/modules/migrate/lib/Drupal/migrate/Plugin/migrate/source/SqlBase.php b/core/modules/migrate/lib/Drupal/migrate/Plugin/migrate/source/SqlBase.php --- b/core/modules/migrate/lib/Drupal/migrate/Plugin/migrate/source/SqlBase.php +++ b/core/modules/migrate/lib/Drupal/migrate/Plugin/migrate/source/SqlBase.php @@ -70,6 +70,11 @@ return Database::getConnection('default', $key); } + protected function select($table, $alias = NULL, array $options = array()) { + $options['fetch'] = \PDO::FETCH_ASSOC; + return $this->getDatabase()->select($table, $alias, $options); + } + /** * Implementation of MigrateSource::performRewind(). * @@ -160,7 +165,7 @@ } } - return $this->query->execute(); + return new \IteratorIterator($this->query->execute()); } /** diff -u b/core/modules/migrate/lib/Drupal/migrate/Plugin/migrate/source/d6/Drupal6SqlBase.php b/core/modules/migrate/lib/Drupal/migrate/Plugin/migrate/source/d6/Drupal6SqlBase.php --- b/core/modules/migrate/lib/Drupal/migrate/Plugin/migrate/source/d6/Drupal6SqlBase.php +++ b/core/modules/migrate/lib/Drupal/migrate/Plugin/migrate/source/d6/Drupal6SqlBase.php @@ -18,10 +18,10 @@ abstract class Drupal6SqlBase extends SqlBase { /** - * Retrieves all system data informationfrom origin system. + * Retrieves all system data information from origin system. * * @return array - * List of system table informationi keyed by type and name. + * List of system table information keyed by type and name. */ public function getSystemData() { static $system_data; @@ -68,2 +68,15 @@ + protected function variableGet($name, $default) { + try { + $result = $this->database + ->query('SELECT value FROM {variable} WHERE name = :name', array(':name' => $name)) + ->fetchField(); + } + // The table might not exist. + catch (\Exception $e) { + $result = FALSE; + } + return $result !== FALSE ? unserialize($result) : $default; + } + } diff -u b/core/modules/migrate/lib/Drupal/migrate/Row.php b/core/modules/migrate/lib/Drupal/migrate/Row.php --- b/core/modules/migrate/lib/Drupal/migrate/Row.php +++ b/core/modules/migrate/lib/Drupal/migrate/Row.php @@ -62,14 +62,14 @@ * @param array $values * An array of values to add as properties on the object. * @param array $source_ids - * An array containing the ids of the source using the keys as the field + * An array containing the IDs of the source using the keys as the field * names. * @param array $destination_ids - * An array containing the ids of the destination using the keys as the field + * An array containing the IDs of the destination using the keys as the field * names. * * @throws \InvalidArgumentException - * Thrown when a source id property does not exist. + * Thrown when a source ID property does not exist. */ public function __construct(array $values, array $source_ids) { $this->source = $values; @@ -196,7 +196,7 @@ } /** - * Sets the Migrate id mappings. + * Sets the Migrate ID mappings. * * @param array $id_map * An array of mappings between source ID and destination ID. @@ -206,7 +206,7 @@ } /** - * Retrieves the Migrate id mappings. + * Retrieves the Migrate ID mappings. * * @return array * An array of mapping between source and destination identifiers. @@ -224,7 +224,7 @@ } /** - * Checks whether the row has changed compared to the original id map. + * Checks whether the row has changed compared to the original ID map. * * return bool * TRUE if the row has changed, FALSE otherwise. If setIdMap() was not diff -u b/core/modules/migrate/lib/Drupal/migrate/Source.php b/core/modules/migrate/lib/Drupal/migrate/Source.php --- b/core/modules/migrate/lib/Drupal/migrate/Source.php +++ b/core/modules/migrate/lib/Drupal/migrate/Source.php @@ -151,7 +151,7 @@ if ($this->skipCount) { return -1; } - $source = $this->migration->getSource(); + $source = $this->migration->getSourcePlugin(); if (!isset($this->cacheKey)) { $this->cacheKey = hash('sha256', (string) $source); @@ -218,7 +218,7 @@ */ protected function getIterator() { if (!isset($this->iterator)) { - $this->iterator = $this->migration->getSource()->getIterator(); + $this->iterator = $this->migration->getSourcePlugin()->getIterator(); } return $this->iterator; } @@ -261,6 +261,7 @@ if ($id_list = $this->migration->get('idlist')) { $this->idList = $id_list; } + $this->getIterator()->rewind(); $this->next(); } @@ -386,7 +387,7 @@ */ protected function prepareRow(Row $row) { // We're explicitly skipping this row - keep track in the map table - if ($this->migration->getSource()->prepareRow($row) === FALSE) { + if ($this->migration->getSourcePlugin()->prepareRow($row) === FALSE) { // Make sure we replace any previous messages for this item with any // new ones. $id_map = $this->migration->getIdMap(); diff -u b/core/modules/migrate/lib/Drupal/migrate/Tests/MigrateSystemConfigsTest.php b/core/modules/migrate/lib/Drupal/migrate/Tests/MigrateSystemConfigsTest.php --- b/core/modules/migrate/lib/Drupal/migrate/Tests/MigrateSystemConfigsTest.php +++ b/core/modules/migrate/lib/Drupal/migrate/Tests/MigrateSystemConfigsTest.php @@ -17,8 +17,8 @@ */ public static function getInfo() { return array( - 'name' => 'Migrate variables to system.site.yml', - 'description' => 'Upgrade variables to system.site.yml', + 'name' => 'Migrate variables to system.*.yml', + 'description' => 'Upgrade variables to system.*.yml', 'group' => 'Migrate', ); } @@ -26,7 +26,7 @@ function testSystemSite() { $migration = entity_load('migration', 'd6_system_site'); $dumps = array( - drupal_get_path('module', 'migrate') . '/ib/Drupal/migrate/Tests/Dump/Drupal6SystemSite.php', + drupal_get_path('module', 'migrate') . '/lib/Drupal/migrate/Tests/Dump/Drupal6SystemSite.php', ); $this->prepare($migration, $dumps); $executable = new MigrateExecutable($migration, new MigrateMessage); @@ -43,2 +43,18 @@ } + + /** + * Tests migration of book variables to system.cron.yml. + */ + public function testSystemCron() { + $migration = entity_load('migration', 'd6_system_cron'); + $dumps = array( + drupal_get_path('module', 'migrate') . '/lib/Drupal/migrate/Tests/Dump/Drupal6SystemCron.php', + ); + $this->prepare($migration, $dumps); + $executable = new MigrateExecutable($migration, new MigrateMessage()); + $executable->import(); + $config = \Drupal::config('system.cron'); + $this->assertIdentical($config->get('threshold.warning'), 172800); + $this->assertIdentical($config->get('threshold.error'), 1209600); + } } diff -u b/core/modules/migrate/lib/Drupal/migrate/Tests/MigrateTestBase.php b/core/modules/migrate/lib/Drupal/migrate/Tests/MigrateTestBase.php --- b/core/modules/migrate/lib/Drupal/migrate/Tests/MigrateTestBase.php +++ b/core/modules/migrate/lib/Drupal/migrate/Tests/MigrateTestBase.php @@ -30,11 +30,15 @@ * @return \Drupal\Core\Database\Connection */ protected function prepare(MigrationInterface $migration, array $files = array()) { - $databasePrefix = 'simpletest_m_' . mt_rand(1000, 1000000); + $databasePrefix = 'm_'; $connection_info = Database::getConnectionInfo('default'); - $connection_info['default']['prefix']['default'] .= $databasePrefix; + foreach ($connection_info as $target => $value) { + $connection_info[$target]['prefix'] = array( + 'default' => $value['prefix']['default'] . $databasePrefix, + ); + } $database = SqlBase::getDatabaseConnection($migration->id(), array('database' => $connection_info['default'])); - foreach (array('source', 'destination', 'id_map') as $key) { + foreach (array('source', 'destination', 'idMap') as $key) { $configuration = $migration->get($key); $configuration['database'] = $database; $migration->set($key, $configuration); @@ -47,7 +51,9 @@ $file = "compress.zlib://$file"; require $file; } - $class = 'Drupal\migrate\Tests\Dump\\' . basename($file, '.php'); + $namespaces = preg_filter('/^namespace (.*);/', '\1', file($file)); + // trim() is necessary to remove the line break file() keeps. + $class = trim(reset($namespaces)) . '\\' . basename($file, '.php'); $class::load($database); } return $database; diff -u b/core/modules/migrate/migrate.api.php b/core/modules/migrate/migrate.api.php --- b/core/modules/migrate/migrate.api.php +++ b/core/modules/migrate/migrate.api.php @@ -20,6 +20,8 @@ * For example, filter module used to store filter format settings in the * variables table which now needs to be inside the filter format config * file. So, it needs to be added here. + * + * hook_migrate_MIGRATION_ID_prepare_row is also available. */ function hook_migrate_prepare_row(Row $row, MigrateSourceInterface $source, MigrationInterface $migration) { if ($migration->id() == 'drupal6_filter_formats') { diff -u b/core/modules/migrate/tests/Drupal/migrate/Tests/FakeSelect.php b/core/modules/migrate/tests/Drupal/migrate/Tests/FakeSelect.php --- b/core/modules/migrate/tests/Drupal/migrate/Tests/FakeSelect.php +++ b/core/modules/migrate/tests/Drupal/migrate/Tests/FakeSelect.php @@ -8,6 +8,7 @@ namespace Drupal\migrate\Tests; use Drupal\Core\Database\Connection; +use Drupal\Core\Database\DatabaseNotFoundException; use Drupal\Core\Database\Query\Condition; use Drupal\Core\Database\Query\PlaceholderInterface; use Drupal\Core\Database\Query\Select; @@ -130,7 +131,7 @@ foreach ($all_rows as $table_rows) { $result_row = array(); foreach ($table_rows as $row) { - $result_row += $row; + $result_row += $row['result']; } $results[] = $result_row; } @@ -158,6 +159,18 @@ $this->fieldsWithTable[$field_info['table'] . '.' . $field_info['field']] = $field_info; $fields[$field_info['table']][$field_info['field']] = NULL; } + foreach ($this->tables as $alias => $table_info) { + if ($table = reset($this->databaseContents[$table_info['table']])) { + foreach (array_keys($table) as $field) { + if (!isset($this->fields[$field])) { + $this->fieldsWithTable[$field] = array( + 'table' => $alias, + 'field' => $field, + ); + } + } + } + } $results = array(); foreach ($this->tables as $table_alias => $table_info) { @@ -166,13 +179,20 @@ foreach ($results as $row) { $joined = FALSE; foreach ($this->databaseContents[$table_info['table']] as $candidate_row) { - if ($row[$table_info['original_table_alias']][$table_info['original_field']] == $candidate_row[$table_info['added_field']]) { + if ($row[$table_info['original_table_alias']]['result'][$table_info['original_field']] == $candidate_row[$table_info['added_field']]) { $joined = TRUE; $new_rows[] = $this->getNewRow($table_alias, $fields, $candidate_row, $row); } } if (!$joined && $table_info['join type'] == 'LEFT') { - $new_rows[] = array($table_alias => $fields[$table_alias]) + $row; + // @TODO: empty tables? Those are a problem. + $keys = array_keys($candidate_row); + $values = array_fill(0, count($keys), NULL); + $new_row = array( + 'result' => $fields[$table_alias], + 'all' => array_combine($keys, $values), + ); + $new_rows[] = array($table_alias => $new_row) + $row; } } $results = $new_rows; @@ -197,9 +217,9 @@ * @return array */ protected function getNewRow($table_alias, $fields, $candidate_row, $row = array()) { - $new_row = array(); + $new_row[$table_alias]['all'] = $candidate_row; foreach ($fields[$table_alias] as $field => $v) { - $new_row[$table_alias][$field] = $candidate_row[$field]; + $new_row[$table_alias]['result'][$field] = $candidate_row[$field]; } return $new_row + $row; } @@ -226,8 +246,8 @@ protected function sortCallback($a, $b) { foreach ($this->order as $field => $direction) { $field_info = $this->getFieldInfo($field); - $a_value = $a[$field_info['table']][$field_info['field']]; - $b_value = $b[$field_info['table']][$field_info['field']]; + $a_value = $this->getValue($a, $field_info); + $b_value = $this->getValue($b, $field_info); if ($a_value != $b_value) { return (($a_value < $b_value) == ($direction == 'ASC')) ? -1 : 1; } @@ -279,6 +299,27 @@ } /** + * Gets the value of a field from a row. + * + * @param $row + * The row array, three levels of indexes: first is the table alias, the + * second is either all or result, the third is the field alias. + * @param $field_info + * The field information array containing the table alias and the + * field alias. + * @return mixed + */ + protected function getValue($row, $field_info) { + if (array_key_exists($field_info['field'], $row[$field_info['table']]['result'])) { + $index = 'result'; + } + else { + $index = 'all'; + } + return $row[$field_info['table']][$index][$field_info['field']]; + } + + /** * Match a single row and its condition. * * @param array $row @@ -295,7 +336,7 @@ */ protected function matchSingle(array $row, array $condition) { $field_info = $this->getFieldInfo($condition['field']); - $row_value = $row[$field_info['table']][$field_info['field']]; + $row_value = $this->getValue($row, $field_info); switch ($condition['operator']) { case '=': return $row_value == $condition['value']; diff -u b/core/modules/migrate/tests/Drupal/migrate/Tests/MigrateExecutableTest.php b/core/modules/migrate/tests/Drupal/migrate/Tests/MigrateExecutableTest.php --- b/core/modules/migrate/tests/Drupal/migrate/Tests/MigrateExecutableTest.php +++ b/core/modules/migrate/tests/Drupal/migrate/Tests/MigrateExecutableTest.php @@ -82,7 +82,7 @@ ->will($this->returnValue($iterator)); $this->migration->expects($this->any()) - ->method('getSource') + ->method('getSourcePlugin') ->will($this->returnValue($source)); // Ensure that a message with the proper message was added. diff -u b/core/modules/migrate/tests/Drupal/migrate/Tests/MigrateSqlSourceTestCase.php b/core/modules/migrate/tests/Drupal/migrate/Tests/MigrateSqlSourceTestCase.php --- b/core/modules/migrate/tests/Drupal/migrate/Tests/MigrateSqlSourceTestCase.php +++ b/core/modules/migrate/tests/Drupal/migrate/Tests/MigrateSqlSourceTestCase.php @@ -48,6 +48,7 @@ $database->expects($this->any())->method('schema')->will($this->returnCallback(function () use ($database, $database_contents) { return new FakeDatabaseSchema($database, $database_contents); })); + $database->expects($this->any())->method('query')->will($this->throwException(new \Exception('Query is not supported'))); $module_handler = $this->getMockBuilder('Drupal\Core\Extension\ModuleHandlerInterface') ->disableOriginalConstructor() ->getMock(); @@ -62,7 +63,7 @@ $plugin->setDatabase($database); $plugin->setModuleHandler($module_handler); $migration->expects($this->any()) - ->method('getSource') + ->method('getSourcePlugin') ->will($this->returnValue($plugin)); $migrateExecutable = $this->getMockBuilder('Drupal\migrate\MigrateExecutable') ->disableOriginalConstructor() @@ -102,7 +103,7 @@ protected function retrievalAssertHelper($expected_value, $actual_value, $message) { if (is_array($expected_value)) { foreach ($expected_value as $k => $v) { - $this->retrievalAssertHelper($v, $actual_value[$k], $message); + $this->retrievalAssertHelper($v, $actual_value[$k], $message . '['. $k . ']'); } } else { only in patch2: unchanged: --- /dev/null +++ b/core/modules/migrate/config/migrate.migration.d6_system_cron.yml @@ -0,0 +1,13 @@ +id: d6_system_cron +source: + plugin: drupal6_variable + variables: + - cron_threshold_warning + - cron_threshold_error + - cron_last +process: + 'threshold:warning': cron_threshold_warning + 'threshold:error': cron_threshold_error +destination: + plugin: d8_config + config_name: system.cron only in patch2: unchanged: --- /dev/null +++ b/core/modules/migrate/lib/Drupal/migrate/Tests/Dump/Drupal6SystemCron.php @@ -0,0 +1,59 @@ +schema()->createTable('variable', array( + 'fields' => array( + 'name' => array( + 'type' => 'varchar', + 'length' => 128, + 'not null' => TRUE, + 'default' => '', + ), + 'value' => array( + 'type' => 'blob', + 'not null' => TRUE, + 'size' => 'big', + 'translatable' => TRUE, + ), + ), + 'primary key' => array( + 'name', + ), + 'module' => 'system', + 'name' => 'variable', + )); + $database->insert('variable')->fields(array( + 'name', + 'value', + )) + ->values(array( + 'name' => 'cron_threshold_warning', + 'value' => 'i:172800;', + )) + ->values(array( + 'name' => 'cron_threshold_error', + 'value' => 'i:1209600;', + )) + ->execute(); + } +}