Update to Drupal 8.0.0 beta 14. For more information, see https://drupal.org/node/2544542
This commit is contained in:
parent
3b2511d96d
commit
81ccda77eb
2155 changed files with 54307 additions and 46870 deletions
|
@ -16,7 +16,7 @@ class Migration extends BaseMigration implements MigrationInterface {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
public $load = array();
|
||||
protected $load = array();
|
||||
|
||||
/**
|
||||
* The load plugin.
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
namespace Drupal\migrate_drupal;
|
||||
|
||||
use Drupal\Component\Utility\SafeMarkup;
|
||||
use Drupal\Component\Uuid\UuidInterface;
|
||||
use Drupal\Core\Config\ConfigFactoryInterface;
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
|
@ -17,7 +16,7 @@ use Drupal\Core\Language\LanguageManagerInterface;
|
|||
use Drupal\migrate\Plugin\migrate\source\SourcePluginBase;
|
||||
use Drupal\migrate_drupal\Plugin\CckFieldMigrateSourceInterface;
|
||||
use Drupal\migrate\MigrationStorage as BaseMigrationStorage;
|
||||
use Drupal\migrate_drupal\Plugin\MigratePluginManager;
|
||||
use Drupal\migrate\Plugin\MigratePluginManager;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
/**
|
||||
|
@ -164,7 +163,7 @@ class MigrationStorage extends BaseMigrationStorage {
|
|||
*/
|
||||
public function save(EntityInterface $entity) {
|
||||
if (strpos($entity->id(), ':') !== FALSE) {
|
||||
throw new EntityStorageException(SafeMarkup::format("Dynamic migration %id can't be saved", array('$%id' => $entity->id())));
|
||||
throw new EntityStorageException("Dynamic migration '{$entity->id()}' can't be saved");
|
||||
}
|
||||
return parent::save($entity);
|
||||
}
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Plugin\MigratePluginManager.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Plugin;
|
||||
|
||||
use Drupal\migrate\Plugin\MigratePluginManager as BaseMigratePluginManager;
|
||||
|
||||
/**
|
||||
* Manages migrate_drupal plugins.
|
||||
*
|
||||
* @see plugin_api
|
||||
*
|
||||
* @ingroup migration
|
||||
*/
|
||||
class MigratePluginManager extends BaseMigratePluginManager {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getPluginInterfaceMap() {
|
||||
return parent::getPluginInterfaceMap() + [
|
||||
'load' => 'Drupal\migrate_drupal\Plugin\MigrateLoadInterface',
|
||||
'cckfield' => 'Drupal\migrate_drupal\Plugin\MigrateCckFieldInterface',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Plugin\migrate\cckfield\FileField.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Plugin\migrate\cckfield;
|
||||
|
||||
use Drupal\migrate\Entity\MigrationInterface;
|
||||
|
||||
/**
|
||||
* @PluginID("filefield")
|
||||
*/
|
||||
class FileField extends CckFieldPluginBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFieldWidgetMap() {
|
||||
return [
|
||||
'filefield_widget' => 'file_generic',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFieldFormatterMap() {
|
||||
return [
|
||||
'default' => 'file_default',
|
||||
'url_plain' => 'file_url_plain',
|
||||
'path_plain' => 'file_url_plain',
|
||||
'image_plain' => 'image',
|
||||
'image_nodelink' => 'image',
|
||||
'image_imagelink' => 'image',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function processCckFieldValues(MigrationInterface $migration, $field_name, $data) {
|
||||
$process = [
|
||||
'plugin' => 'd6_cck_file',
|
||||
'source' => [
|
||||
$field_name,
|
||||
$field_name . '_list',
|
||||
$field_name . '_data',
|
||||
],
|
||||
];
|
||||
$migration->mergeProcessOfProperty($field_name, $process);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Plugin\migrate\cckfield\TextField.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Plugin\migrate\cckfield;
|
||||
|
||||
use Drupal\migrate\Entity\MigrationInterface;
|
||||
|
||||
/**
|
||||
* @PluginID("text")
|
||||
*/
|
||||
class TextField extends CckFieldPluginBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFieldWidgetMap() {
|
||||
return [
|
||||
'text_textfield' => 'text_textfield',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFieldFormatterMap() {
|
||||
return [
|
||||
'default' => 'text_default',
|
||||
'trimmed' => 'text_trimmed',
|
||||
'plain' => 'basic_string',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function processCckFieldValues(MigrationInterface $migration, $field_name, $data) {
|
||||
// The data is stored differently depending on whether we're using
|
||||
// db storage.
|
||||
$value_key = $data['db_storage'] ? $field_name : "$field_name/value";
|
||||
$format_key = $data['db_storage'] ? $field_name . '_format' : "$field_name/format" ;
|
||||
|
||||
$migration->setProcessOfProperty("$field_name/value", $value_key);
|
||||
|
||||
// See \Drupal\migrate_drupal\Plugin\migrate\source\d6\User::baseFields(),
|
||||
// signature_format for an example of the YAML that represents this
|
||||
// process array.
|
||||
$process = [
|
||||
[
|
||||
'plugin' => 'static_map',
|
||||
'bypass' => TRUE,
|
||||
'source' => $format_key,
|
||||
'map' => [0 => NULL]
|
||||
],
|
||||
[
|
||||
'plugin' => 'skip_on_empty',
|
||||
'method' => 'process',
|
||||
],
|
||||
[
|
||||
'plugin' => 'migration',
|
||||
'migration' => 'd6_filter_format',
|
||||
'source' => $format_key,
|
||||
],
|
||||
];
|
||||
$migration->mergeProcessOfProperty("$field_name/format", $process);
|
||||
}
|
||||
|
||||
}
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
namespace Drupal\migrate_drupal\Plugin\migrate\load;
|
||||
|
||||
use Drupal\Component\Utility\SafeMarkup;
|
||||
use Drupal\Core\Entity\EntityStorageInterface;
|
||||
use Drupal\Core\Plugin\PluginBase;
|
||||
use Drupal\migrate\Entity\MigrationInterface;
|
||||
|
@ -44,7 +43,7 @@ class LoadEntity extends PluginBase implements MigrateLoadInterface {
|
|||
throw new MigrateException('Migrations with a load plugin using LoadEntity should have an entity as source.');
|
||||
}
|
||||
if ($source_plugin->bundleMigrationRequired() && empty($configuration['bundle_migration'])) {
|
||||
throw new MigrateException(SafeMarkup::format('Source plugin @plugin requires the bundle_migration key to be set.', array('@plugin' => $source_plugin->getPluginId())));
|
||||
throw new MigrateException("Source plugin '{$source_plugin->getPluginId()}' requires the bundle_migration key to be set.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -87,16 +86,7 @@ class LoadEntity extends PluginBase implements MigrateLoadInterface {
|
|||
|
||||
if ($source_plugin instanceof CckFieldMigrateSourceInterface) {
|
||||
foreach ($source_plugin->fieldData() as $field_name => $data) {
|
||||
switch ($data['type']) {
|
||||
case 'filefield':
|
||||
$this->processFileField($field_name, $data, $migration);
|
||||
break;
|
||||
case 'text':
|
||||
$this->processTextField($field_name, $data, $migration);
|
||||
break;
|
||||
default:
|
||||
$migration->setProcessOfProperty($field_name, $field_name);
|
||||
}
|
||||
$migration->setProcessOfProperty($field_name, $field_name);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -113,67 +103,4 @@ class LoadEntity extends PluginBase implements MigrateLoadInterface {
|
|||
return $migrations;
|
||||
}
|
||||
|
||||
/**
|
||||
* Manipulate text fields with any per field type processing.
|
||||
*
|
||||
* @param string $field_name
|
||||
* The field we're processing.
|
||||
* @param array $field_data
|
||||
* The an array of field type data from the source.
|
||||
* @param \Drupal\migrate\Entity\MigrationInterface $migration
|
||||
* The migration entity.
|
||||
*/
|
||||
protected function processTextField($field_name, $field_data, MigrationInterface $migration) {
|
||||
// The data is stored differently depending on whether we're using
|
||||
// db storage.
|
||||
$value_key = $field_data['db_storage'] ? $field_name : "$field_name/value";
|
||||
$format_key = $field_data['db_storage'] ? $field_name . '_format' : "$field_name/format" ;
|
||||
|
||||
$migration->setProcessOfProperty("$field_name/value", $value_key);
|
||||
|
||||
// See \Drupal\migrate_drupal\Plugin\migrate\source\d6\User::baseFields(),
|
||||
// signature_format for an example of the YAML that represents this
|
||||
// process array.
|
||||
$process = [
|
||||
[
|
||||
'plugin' => 'static_map',
|
||||
'bypass' => TRUE,
|
||||
'source' => $format_key,
|
||||
'map' => [0 => NULL]
|
||||
],
|
||||
[
|
||||
'plugin' => 'skip_on_empty',
|
||||
'method' => 'process',
|
||||
],
|
||||
[
|
||||
'plugin' => 'migration',
|
||||
'migration' => 'd6_filter_format',
|
||||
'source' => $format_key,
|
||||
],
|
||||
];
|
||||
$migration->mergeProcessOfProperty("$field_name/format", $process);
|
||||
}
|
||||
|
||||
/**
|
||||
* Manipulate file fields with any per field type processing.
|
||||
*
|
||||
* @param string $field_name
|
||||
* The field we're processing.
|
||||
* @param array $field_data
|
||||
* The an array of field type data from the source.
|
||||
* @param \Drupal\migrate\Entity\MigrationInterface $migration
|
||||
* The migration entity.
|
||||
*/
|
||||
protected function processFileField($field_name, $field_data, MigrationInterface $migration) {
|
||||
$process = [
|
||||
'plugin' => 'd6_cck_file',
|
||||
'source' => [
|
||||
$field_name,
|
||||
$field_name . '_list',
|
||||
$field_name . '_data',
|
||||
],
|
||||
];
|
||||
$migration->mergeProcessOfProperty($field_name, $process);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,64 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Plugin\migrate\load\d6\LoadTermNode.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Plugin\migrate\load\d6;
|
||||
|
||||
use Drupal\Core\Entity\EntityStorageInterface;
|
||||
use Drupal\migrate\Entity\MigrationInterface;
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\migrate\MigrateMessage;
|
||||
use Drupal\migrate\Row;
|
||||
use Drupal\migrate_drupal\Plugin\migrate\load\LoadEntity;
|
||||
|
||||
/**
|
||||
* @PluginID("d6_term_node")
|
||||
*/
|
||||
class LoadTermNode extends LoadEntity {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function __construct(array $configuration, $plugin_id, array $plugin_definition, MigrationInterface $migration) {
|
||||
$configuration['bundle_migration'] = 'd6_taxonomy_vocabulary';
|
||||
parent::__construct($configuration, $plugin_id, $plugin_definition, $migration);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function loadMultiple(EntityStorageInterface $storage, array $sub_ids = NULL) {
|
||||
/** @var \Drupal\migrate\Entity\MigrationInterface $bundle_migration */
|
||||
$bundle_migration = $storage->load('d6_taxonomy_vocabulary');
|
||||
$migrate_executable = new MigrateExecutable($bundle_migration, new MigrateMessage());
|
||||
$process = array_intersect_key($bundle_migration->get('process'), $bundle_migration->getDestinationPlugin()->getIds());
|
||||
$migrations = array();
|
||||
$vid_map = array();
|
||||
foreach ($bundle_migration->getIdMap() as $key => $value) {
|
||||
$old_vid = unserialize($key)['sourceid1'];
|
||||
$new_vid = $value['destid1'];
|
||||
$vid_map[$old_vid] = $new_vid;
|
||||
}
|
||||
foreach ($bundle_migration->getSourcePlugin()->getIterator() as $source_row) {
|
||||
$row = new Row($source_row, $source_row);
|
||||
$migrate_executable->processRow($row, $process);
|
||||
$old_vid = $source_row['vid'];
|
||||
$new_vid = $row->getDestinationProperty('vid');
|
||||
$vid_map[$old_vid] = $new_vid;
|
||||
}
|
||||
foreach ($vid_map as $old_vid => $new_vid) {
|
||||
$values = $this->migration->toArray();
|
||||
$migration_id = $this->migration->id() . ':' . $old_vid;
|
||||
$values['id'] = $migration_id;
|
||||
$values['source']['vid'] = $old_vid;
|
||||
$values['process'][$new_vid] = 'tid';
|
||||
$migrations[$migration_id] = $storage->create($values);;
|
||||
}
|
||||
|
||||
return $migrations;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,100 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Plugin\migrate\process\d6\BlockPluginId.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Plugin\migrate\process\d6;
|
||||
|
||||
use Drupal\Core\Entity\EntityStorageInterface;
|
||||
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
|
||||
use Drupal\migrate\Entity\MigrationInterface;
|
||||
use Drupal\migrate\MigrateExecutableInterface;
|
||||
use Drupal\migrate\MigrateSkipRowException;
|
||||
use Drupal\migrate\Plugin\MigratePluginManager;
|
||||
use Drupal\migrate\ProcessPluginBase;
|
||||
use Drupal\migrate\Row;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
/**
|
||||
* @MigrateProcessPlugin(
|
||||
* id = "d6_block_plugin_id"
|
||||
* )
|
||||
*/
|
||||
class BlockPluginId extends ProcessPluginBase implements ContainerFactoryPluginInterface {
|
||||
|
||||
/**
|
||||
* @var \Drupal\migrate\Plugin\MigratePluginManager
|
||||
*/
|
||||
protected $processPluginManager;
|
||||
|
||||
/**
|
||||
* @var \Drupal\Core\Entity\EntityStorageInterface
|
||||
*/
|
||||
protected $blockContentStorage;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function __construct(array $configuration, $plugin_id, array $plugin_definition, MigrationInterface $migration, EntityStorageInterface $storage, MigratePluginManager $process_plugin_manager) {
|
||||
parent::__construct($configuration, $plugin_id, $plugin_definition);
|
||||
$this->blockContentStorage = $storage;
|
||||
$this->migration = $migration;
|
||||
$this->processPluginManager = $process_plugin_manager;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
|
||||
$entity_manager = $container->get('entity.manager');
|
||||
return new static(
|
||||
$configuration,
|
||||
$plugin_id,
|
||||
$plugin_definition,
|
||||
$migration,
|
||||
$entity_manager->getDefinition('block_content') ? $entity_manager->getStorage('block_content') : NULL,
|
||||
$container->get('plugin.manager.migrate.process')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* Set the block plugin id.
|
||||
*/
|
||||
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
|
||||
if (is_array($value)) {
|
||||
list($module, $delta) = $value;
|
||||
switch ($module) {
|
||||
case 'aggregator':
|
||||
list($type, $id) = explode('-', $delta);
|
||||
if ($type == 'category') {
|
||||
// @TODO skip row.
|
||||
// throw new MigrateSkipRowException();
|
||||
}
|
||||
$value = 'aggregator_feed_block';
|
||||
break;
|
||||
case 'menu':
|
||||
$value = "system_menu_block:$delta";
|
||||
break;
|
||||
case 'block':
|
||||
if ($this->blockContentStorage) {
|
||||
$block_ids = $this->processPluginManager
|
||||
->createInstance('migration', array('migration' => 'd6_custom_block'), $this->migration)
|
||||
->transform($delta, $migrate_executable, $row, $destination_property);
|
||||
$value = 'block_content:' . $this->blockContentStorage->load($block_ids[0])->uuid();
|
||||
}
|
||||
else {
|
||||
throw new MigrateSkipRowException();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new MigrateSkipRowException();
|
||||
}
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Plugin\migrate\process\d6\BlockRegion.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Plugin\migrate\process\d6;
|
||||
|
||||
use Drupal\Component\Utility\NestedArray;
|
||||
use Drupal\migrate\MigrateExecutableInterface;
|
||||
use Drupal\migrate\ProcessPluginBase;
|
||||
use Drupal\migrate\Row;
|
||||
|
||||
/**
|
||||
* @MigrateProcessPlugin(
|
||||
* id = "d6_block_region"
|
||||
* )
|
||||
*/
|
||||
class BlockRegion extends ProcessPluginBase {
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* Set the destination block region, based on the source region and theme as
|
||||
* well as the current destination default theme.
|
||||
*/
|
||||
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
|
||||
list($region, $source_theme, $destination_theme) = $value;
|
||||
|
||||
// Theme is the same on both source and destination, we will assume they
|
||||
// have the same regions.
|
||||
if (strtolower($source_theme) == strtolower($destination_theme)) {
|
||||
return $region;
|
||||
}
|
||||
|
||||
// If the source and destination theme are different, try to use the
|
||||
// mappings defined in the configuration.
|
||||
$region_map = $this->configuration['region_map'];
|
||||
if (isset($region_map[$region])) {
|
||||
return $region_map[$region];
|
||||
}
|
||||
|
||||
// Oh well, we tried. Put the block in the main content region.
|
||||
return 'content';
|
||||
}
|
||||
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Plugin\migrate\process\d6\BlockSettings.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Plugin\migrate\process\d6;
|
||||
|
||||
use Drupal\migrate\MigrateExecutableInterface;
|
||||
use Drupal\migrate\ProcessPluginBase;
|
||||
use Drupal\migrate\Row;
|
||||
|
||||
/**
|
||||
* @MigrateProcessPlugin(
|
||||
* id = "d6_block_settings"
|
||||
* )
|
||||
*/
|
||||
class BlockSettings extends ProcessPluginBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* Set the block configuration.
|
||||
*/
|
||||
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
|
||||
list($plugin, $delta, $old_settings) = $value;
|
||||
$settings = array();
|
||||
switch ($plugin) {
|
||||
case 'aggregator_feed_block':
|
||||
list(, $id) = explode('-', $delta);
|
||||
$settings['block_count'] = $old_settings['aggregator']['item_count'];
|
||||
$settings['feed'] = $id;
|
||||
break;
|
||||
case 'book_navigation':
|
||||
$settings['block_mode'] = $old_settings['book']['block_mode'];
|
||||
break;
|
||||
case 'forum_active_block':
|
||||
case 'forum_new_block':
|
||||
$settings['block_count'] = $old_settings['forum']['block_num'];
|
||||
break;
|
||||
case 'statistics_popular_block':
|
||||
$settings['top_day_num'] = $old_settings['statistics']['statistics_block_top_day_num'];
|
||||
$settings['top_all_num'] = $old_settings['statistics']['statistics_block_top_all_num'];
|
||||
$settings['top_last_num'] = $old_settings['statistics']['statistics_block_top_last_num'];
|
||||
break;
|
||||
case 'views_block:who_s_new-block_1':
|
||||
$settings['items_per_page'] = $old_settings['user']['block_whois_new_count'];
|
||||
break;
|
||||
case 'views_block:who_s_online-who_s_online_block':
|
||||
$settings['items_per_page'] = $old_settings['user']['max_list_count'];
|
||||
break;
|
||||
}
|
||||
return $settings;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,103 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Plugin\migrate\process\d6\BlockTheme.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Plugin\migrate\process\d6;
|
||||
|
||||
use Drupal\migrate\Entity\MigrationInterface;
|
||||
use Drupal\migrate\MigrateExecutableInterface;
|
||||
use Drupal\migrate\ProcessPluginBase;
|
||||
use Drupal\migrate\Row;
|
||||
use Drupal\Core\Config\Config;
|
||||
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
/**
|
||||
* @MigrateProcessPlugin(
|
||||
* id = "d6_block_theme"
|
||||
* )
|
||||
*/
|
||||
class BlockTheme extends ProcessPluginBase implements ContainerFactoryPluginInterface {
|
||||
|
||||
/**
|
||||
* Contains the configuration object factory.
|
||||
*
|
||||
* @var \Drupal\Core\Config\ConfigFactoryInterface
|
||||
*/
|
||||
protected $configFactory;
|
||||
|
||||
/**
|
||||
* Contains the system.theme configuration object.
|
||||
*
|
||||
* @var \Drupal\Core\Config\Config
|
||||
*/
|
||||
protected $themeConfig;
|
||||
|
||||
/**
|
||||
* Constructs a BlockTheme object.
|
||||
*
|
||||
* @param array $configuration
|
||||
* A configuration array containing information about the plugin instance.
|
||||
* @param string $plugin_id
|
||||
* The plugin ID for the plugin instance.
|
||||
* @param mixed $plugin_definition
|
||||
* The plugin implementation definition.
|
||||
* @param \Drupal\migrate\Entity\MigrationInterface $migration
|
||||
* The migration entity.
|
||||
* @param \Drupal\Core\Config\Config $theme_config
|
||||
* The system.theme configuration factory object.
|
||||
* @param array $themes
|
||||
* The list of themes available on the destination.
|
||||
*/
|
||||
public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, Config $theme_config, array $themes) {
|
||||
parent::__construct($configuration, $plugin_id, $plugin_definition, $migration);
|
||||
$this->themeConfig = $theme_config;
|
||||
$this->themes = $themes;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
|
||||
return new static(
|
||||
$configuration,
|
||||
$plugin_id,
|
||||
$plugin_definition,
|
||||
$migration,
|
||||
$container->get('config.factory')->get('system.theme'),
|
||||
$container->get('theme_handler')->listInfo()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* Set the block theme, based on the current default theme.
|
||||
*/
|
||||
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
|
||||
list($theme, $d6_default_theme, $d6_admin_theme) = $value;
|
||||
|
||||
// If the source theme exists on the destination, we're good.
|
||||
if (isset($this->themes[$theme])) {
|
||||
return $theme;
|
||||
}
|
||||
|
||||
// If the source block is assigned to a region in the source default theme,
|
||||
// then assign it to the destination default theme.
|
||||
if (strtolower($theme) == strtolower($d6_default_theme)) {
|
||||
return $this->themeConfig->get('default');
|
||||
}
|
||||
|
||||
// If the source block is assigned to a region in the source admin theme,
|
||||
// then assign it to the destination admin theme.
|
||||
if (strtolower($theme) == strtolower($d6_admin_theme)) {
|
||||
return $this->themeConfig->get('admin');
|
||||
}
|
||||
|
||||
// We couldn't map it to a D8 theme so just return the incoming theme.
|
||||
return $theme;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,79 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Plugin\migrate\process\d6\BlockVisibility.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Plugin\migrate\process\d6;
|
||||
|
||||
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
|
||||
use Drupal\migrate\MigrateExecutableInterface;
|
||||
use Drupal\migrate\ProcessPluginBase;
|
||||
use Drupal\migrate\Row;
|
||||
use Drupal\migrate\Entity\MigrationInterface;
|
||||
use Drupal\migrate\Plugin\MigrateProcessInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
/**
|
||||
* @MigrateProcessPlugin(
|
||||
* id = "d6_block_visibility"
|
||||
* )
|
||||
*/
|
||||
class BlockVisibility extends ProcessPluginBase implements ContainerFactoryPluginInterface {
|
||||
|
||||
/**
|
||||
* The migration plugin.
|
||||
*
|
||||
* @var \Drupal\migrate\Plugin\MigrateProcessInterface
|
||||
*/
|
||||
protected $migrationPlugin;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, MigrateProcessInterface $migration_plugin) {
|
||||
parent::__construct($configuration, $plugin_id, $plugin_definition);
|
||||
$this->migration = $migration;
|
||||
$this->migrationPlugin = $migration_plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
|
||||
return new static(
|
||||
$configuration,
|
||||
$plugin_id,
|
||||
$plugin_definition,
|
||||
$migration,
|
||||
$container->get('plugin.manager.migrate.process')->createInstance('migration', array('migration' => 'd6_user_role'), $migration)
|
||||
);
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* Set the block visibility settings.
|
||||
*/
|
||||
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
|
||||
list($pages, $roles, $old_visibility) = $value;
|
||||
$visibility = array();
|
||||
|
||||
if (!empty($pages)) {
|
||||
$visibility['request_path']['pages'] = $pages;
|
||||
$visibility['request_path']['id'] = 'request_path';
|
||||
$visibility['request_path']['negate'] = !$old_visibility;
|
||||
}
|
||||
|
||||
if (!empty($roles)) {
|
||||
foreach ($roles as $key => $role_id) {
|
||||
$new_role = $this->migrationPlugin->transform($role_id, $migrate_executable, $row, $destination_property);
|
||||
$visibility['user_role']['roles'][$new_role] = $new_role;
|
||||
}
|
||||
$visibility['user_role']['id'] = 'user_role';
|
||||
$visibility['user_role']['context_mapping']['user'] = 'user.current_user';
|
||||
}
|
||||
return $visibility;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Plugin\migrate\process\d6\NodeUpdate7008.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Plugin\migrate\process\d6;
|
||||
|
||||
use Drupal\migrate\MigrateExecutableInterface;
|
||||
use Drupal\migrate\ProcessPluginBase;
|
||||
use Drupal\migrate\Row;
|
||||
|
||||
/**
|
||||
* Split the 'administer nodes' permission from 'access content overview'.
|
||||
*
|
||||
* @MigrateProcessPlugin(
|
||||
* id = "node_update_7008"
|
||||
* )
|
||||
*/
|
||||
class NodeUpdate7008 extends ProcessPluginBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* Split the 'administer nodes' permission from 'access content overview'.
|
||||
*/
|
||||
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
|
||||
if ($value === 'administer nodes') {
|
||||
return array($value, 'access content overview');
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Plugin\migrate\process\d6\SearchConfigurationRankings.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Plugin\migrate\process\d6;
|
||||
|
||||
use Drupal\migrate\ProcessPluginBase;
|
||||
use Drupal\migrate\MigrateExecutableInterface;
|
||||
use Drupal\migrate\Row;
|
||||
|
||||
/**
|
||||
* Generate configuration rankings.
|
||||
*
|
||||
* @MigrateProcessPlugin(
|
||||
* id = "d6_search_configuration_rankings"
|
||||
* )
|
||||
*/
|
||||
class SearchConfigurationRankings extends ProcessPluginBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* Generate the configuration rankings.
|
||||
*/
|
||||
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
|
||||
$return = array();
|
||||
foreach ($row->getSource() as $name => $rank) {
|
||||
if (substr($name, 0, 10) == 'node_rank_' && $rank) {
|
||||
$return[substr($name, 10)] = $rank;
|
||||
}
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Plugin\migrate\process\d6\SystemUpdate7000.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Plugin\migrate\process\d6;
|
||||
|
||||
use Drupal\migrate\MigrateExecutableInterface;
|
||||
use Drupal\migrate\ProcessPluginBase;
|
||||
use Drupal\migrate\Row;
|
||||
|
||||
/**
|
||||
* Rename blog and forum permissions to be consistent with other content types.
|
||||
*
|
||||
* @MigrateProcessPlugin(
|
||||
* id = "system_update_7000"
|
||||
* )
|
||||
*/
|
||||
class SystemUpdate7000 extends ProcessPluginBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* Rename blog and forum permissions to be consistent with other content types.
|
||||
*/
|
||||
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
|
||||
$value = preg_replace('/(?<=^|,\ )create\ blog\ entries(?=,|$)/', 'create blog content', $value);
|
||||
$value = preg_replace('/(?<=^|,\ )edit\ own\ blog\ entries(?=,|$)/', 'edit own blog content', $value);
|
||||
$value = preg_replace('/(?<=^|,\ )edit\ any\ blog\ entry(?=,|$)/', 'edit any blog content', $value);
|
||||
$value = preg_replace('/(?<=^|,\ )delete\ own\ blog\ entries(?=,|$)/', 'delete own blog content', $value);
|
||||
$value = preg_replace('/(?<=^|,\ )delete\ any\ blog\ entry(?=,|$)/', 'delete any blog content', $value);
|
||||
|
||||
$value = preg_replace('/(?<=^|,\ )create\ forum\ topics(?=,|$)/', 'create forum content', $value);
|
||||
$value = preg_replace('/(?<=^|,\ )delete\ any\ forum\ topic(?=,|$)/', 'delete any forum content', $value);
|
||||
$value = preg_replace('/(?<=^|,\ )delete\ own\ forum\ topics(?=,|$)/', 'delete own forum content', $value);
|
||||
$value = preg_replace('/(?<=^|,\ )edit\ any\ forum\ topic(?=,|$)/', 'edit any forum content', $value);
|
||||
$value = preg_replace('/(?<=^|,\ )edit\ own\ forum\ topics(?=,|$)/', 'edit own forum content', $value);
|
||||
return $value;
|
||||
}
|
||||
|
||||
}
|
|
@ -8,7 +8,6 @@
|
|||
namespace Drupal\migrate_drupal\Plugin\migrate\source;
|
||||
|
||||
use Drupal\Component\Plugin\DependentPluginInterface;
|
||||
use Drupal\Component\Utility\SafeMarkup;
|
||||
use Drupal\Core\Entity\DependencyTrait;
|
||||
use Drupal\Core\Entity\EntityManagerInterface;
|
||||
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
|
||||
|
@ -102,11 +101,11 @@ abstract class DrupalSqlBase extends SqlBase implements ContainerFactoryPluginIn
|
|||
if (isset($this->pluginDefinition['source_provider'])) {
|
||||
if ($this->moduleExists($this->pluginDefinition['source_provider'])) {
|
||||
if (isset($this->pluginDefinition['minimum_schema_version']) && !$this->getModuleSchemaVersion($this->pluginDefinition['source_provider']) < $this->pluginDefinition['minimum_schema_version']) {
|
||||
throw new RequirementsException(SafeMarkup::format('Required minimum schema version @minimum_schema_version', ['@minimum_schema_version' => $this->pluginDefinition['minimum_schema_version']]), ['minimum_schema_version' => $this->pluginDefinition['minimum_schema_version']]);
|
||||
throw new RequirementsException('Required minimum schema version ' . $this->pluginDefinition['minimum_schema_version'], ['minimum_schema_version' => $this->pluginDefinition['minimum_schema_version']]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw new RequirementsException(SafeMarkup::format('Missing source provider @provider', ['@provider' => $this->pluginDefinition['source_provider']]), ['source_provider' => $this->pluginDefinition['source_provider']]);
|
||||
throw new RequirementsException('Missing source provider ' . $this->pluginDefinition['source_provider'], ['source_provider' => $this->pluginDefinition['source_provider']]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,58 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Plugin\migrate\source\d6\Action.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Plugin\migrate\source\d6;
|
||||
|
||||
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
|
||||
|
||||
/**
|
||||
* Drupal 6 action source from database.
|
||||
*
|
||||
* @MigrateSource(
|
||||
* id = "d6_action"
|
||||
* )
|
||||
*/
|
||||
class Action extends DrupalSqlBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function query() {
|
||||
$query = $this->select('actions', 'a')
|
||||
->fields('a', array(
|
||||
'aid',
|
||||
'type',
|
||||
'callback',
|
||||
'parameters',
|
||||
'description',
|
||||
)
|
||||
);
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fields() {
|
||||
return array(
|
||||
'aid' => $this->t('Action ID'),
|
||||
'type' => $this->t('Module'),
|
||||
'callback' => $this->t('Callback function'),
|
||||
'parameters' => $this->t('Action configuration'),
|
||||
'description' => $this->t('Action description'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getIds() {
|
||||
$ids['aid']['type'] = 'string';
|
||||
return $ids;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,72 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Plugin\migrate\source\d6\AggregatorFeed.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Plugin\migrate\source\d6;
|
||||
|
||||
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
|
||||
|
||||
/**
|
||||
* Drupal 6 feed source from database.
|
||||
*
|
||||
* @MigrateSource(
|
||||
* id = "d6_aggregator_feed",
|
||||
* source_provider = "aggregator"
|
||||
* )
|
||||
*/
|
||||
class AggregatorFeed extends DrupalSqlBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function query() {
|
||||
$query = $this->select('aggregator_feed', 'af')
|
||||
->fields('af', array(
|
||||
'fid',
|
||||
'title',
|
||||
'url',
|
||||
'refresh',
|
||||
'checked',
|
||||
'link',
|
||||
'description',
|
||||
'image',
|
||||
'etag',
|
||||
'modified',
|
||||
'block',
|
||||
));
|
||||
|
||||
$query->orderBy('fid');
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fields() {
|
||||
return array(
|
||||
'fid' => $this->t('The feed ID.'),
|
||||
'title' => $this->t('Title of the feed.'),
|
||||
'url' => $this->t('URL to the feed.'),
|
||||
'refresh' => $this->t('Refresh frequency in seconds.'),
|
||||
'checked' => $this->t('Last-checked unix timestamp.'),
|
||||
'link' => $this->t('Parent website of feed.'),
|
||||
'description' => $this->t('Parent website\'s description fo the feed.'),
|
||||
'image' => $this->t('An image representing the feed.'),
|
||||
'etag' => $this->t('Entity tag HTTP response header.'),
|
||||
'modified' => $this->t('When the feed was last modified.'),
|
||||
'block' => $this->t("Number of items to display in the feed's block."),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getIds() {
|
||||
$ids['fid']['type'] = 'integer';
|
||||
return $ids;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Plugin\migrate\source\d6\AggregatorItem.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Plugin\migrate\source\d6;
|
||||
|
||||
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
|
||||
|
||||
/**
|
||||
* Drupal 6 aggregator item source from database.
|
||||
*
|
||||
* @MigrateSource(
|
||||
* id = "d6_aggregator_item",
|
||||
* source_provider = "aggregator"
|
||||
* )
|
||||
*/
|
||||
class AggregatorItem extends DrupalSqlBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function query() {
|
||||
$query = $this->select('aggregator_item', 'ai')
|
||||
->fields('ai', array('iid', 'fid', 'title', 'link', 'author',
|
||||
'description', 'timestamp', 'guid'))
|
||||
->orderBy('iid');
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fields() {
|
||||
return array(
|
||||
'iid' => $this->t('Primary Key: Unique ID for feed item.'),
|
||||
'fid' => $this->t('The {aggregator_feed}.fid to which this item belongs.'),
|
||||
'title' => $this->t('Title of the feed item.'),
|
||||
'link' => $this->t('Link to the feed item.'),
|
||||
'author' => $this->t('Author of the feed item.'),
|
||||
'description' => $this->t('Body of the feed item.'),
|
||||
'timestamp' => $this->t('Post date of feed item, as a Unix timestamp.'),
|
||||
'guid' => $this->t('Unique identifier for the feed item.'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getIds() {
|
||||
$ids['iid']['type'] = 'integer';
|
||||
return $ids;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,139 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Plugin\migrate\source\d6\Block.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Plugin\migrate\source\d6;
|
||||
|
||||
use Drupal\migrate\Row;
|
||||
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
|
||||
|
||||
/**
|
||||
* Drupal 6 block source from database.
|
||||
*
|
||||
* @MigrateSource(
|
||||
* id = "d6_block"
|
||||
* )
|
||||
*/
|
||||
class Block extends DrupalSqlBase {
|
||||
/**
|
||||
* The default theme name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $defaultTheme;
|
||||
|
||||
/**
|
||||
* The admin theme name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $adminTheme;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function query() {
|
||||
$query = $this->select('blocks', 'b')
|
||||
->fields('b', array('bid', 'module', 'delta', 'theme', 'status', 'weight', 'region', 'visibility', 'pages', 'title', 'cache'))
|
||||
->orderBy('bid');
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function initializeIterator() {
|
||||
$this->defaultTheme = $this->variableGet('theme_default', 'Garland');
|
||||
$this->adminTheme = $this->variableGet('admin_theme', null);
|
||||
return parent::initializeIterator();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fields() {
|
||||
return array(
|
||||
'bid' => $this->t('The block numeric identifier.'),
|
||||
'module' => $this->t('The module providing the block.'),
|
||||
'delta' => $this->t('The block\'s delta.'),
|
||||
'theme' => $this->t('Which theme the block is placed in.'),
|
||||
'status' => $this->t('Whether or not the block is enabled.'),
|
||||
'weight' => $this->t('Weight of the block for ordering within regions.'),
|
||||
'region' => $this->t('Region the block is placed in.'),
|
||||
'visibility' => $this->t('Visibility expression.'),
|
||||
'pages' => $this->t('Pages list.'),
|
||||
'title' => $this->t('Block title.'),
|
||||
'cache' => $this->t('Cache rule.'),
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function prepareRow(Row $row) {
|
||||
$row->setSourceProperty('default_theme', $this->defaultTheme);
|
||||
$row->setSourceProperty('admin_theme', $this->adminTheme);
|
||||
$module = $row->getSourceProperty('module');
|
||||
$delta = $row->getSourceProperty('delta');
|
||||
$roles = $this->select('blocks_roles', 'br')
|
||||
->fields('br', array('rid'))
|
||||
->condition('module', $module)
|
||||
->condition('delta', $delta)
|
||||
->execute()
|
||||
->fetchCol();
|
||||
$row->setSourceProperty('roles', $roles);
|
||||
$settings = array();
|
||||
// Contrib can use hook_migration_d6_block_prepare_row() to add similar
|
||||
// variables via $migration->getSource()->variableGet().
|
||||
switch ($module) {
|
||||
case 'aggregator':
|
||||
list($type, $id) = explode('-', $delta);
|
||||
if ($type == 'feed') {
|
||||
$item_count = $this->database->query('SELECT block FROM {aggregator_feed} WHERE fid = :fid', array(':fid' => $id))->fetchField();
|
||||
}
|
||||
else {
|
||||
$item_count = $this->database->query('SELECT block FROM {aggregator_category} WHERE cid = :cid', array(':cid' => $id))->fetchField();
|
||||
}
|
||||
$settings['aggregator']['item_count'] = $item_count;
|
||||
break;
|
||||
case 'book':
|
||||
$settings['book']['block_mode'] = $this->variableGet('book_block_mode', 'all pages');
|
||||
break;
|
||||
case 'forum':
|
||||
$settings['forum']['block_num'] = $this->variableGet('forum_block_num_'. $delta, 5);
|
||||
break;
|
||||
case 'statistics':
|
||||
foreach (array('statistics_block_top_day_num', 'statistics_block_top_all_num', 'statistics_block_top_last_num') as $name) {
|
||||
$settings['statistics'][$name] = $this->variableGet($name, 0);
|
||||
}
|
||||
break;
|
||||
case 'user':
|
||||
switch ($delta) {
|
||||
case 2:
|
||||
$settings['user']['block_whois_new_count'] = $this->variableGet('user_block_whois_new_count', 5);
|
||||
break;
|
||||
case 3:
|
||||
$settings['user']['block_seconds_online'] = $this->variableGet('user_block_seconds_online', 900);
|
||||
$settings['user']['max_list_count'] = $this->variableGet('user_block_max_list_count', 10);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
$row->setSourceProperty('settings', $settings);
|
||||
return parent::prepareRow($row);
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getIds() {
|
||||
$ids['module']['type'] = 'string';
|
||||
$ids['delta']['type'] = 'string';
|
||||
$ids['theme']['type'] = 'string';
|
||||
return $ids;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,68 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Plugin\migrate\source\d6\Book.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Plugin\migrate\source\d6;
|
||||
|
||||
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
|
||||
|
||||
/**
|
||||
* Drupal 6 book source.
|
||||
*
|
||||
* @MigrateSource(
|
||||
* id = "d6_book"
|
||||
* )
|
||||
*/
|
||||
class Book extends DrupalSqlBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function query() {
|
||||
$query = $this->select('book', 'b')->fields('b', array('nid', 'bid'));
|
||||
$query->join('menu_links', 'ml', 'b.mlid = ml.mlid');
|
||||
$ml_fields = array('mlid', 'plid', 'weight', 'has_children', 'depth');
|
||||
for ($i = 1; $i <= 9; $i++) {
|
||||
$field = "p$i";
|
||||
$ml_fields[] = $field;
|
||||
$query->orderBy($field);
|
||||
}
|
||||
$query->fields('ml', $ml_fields);
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getIds() {
|
||||
$ids['mlid']['type'] = 'integer';
|
||||
$ids['mlid']['alias'] = 'ml';
|
||||
return $ids;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fields() {
|
||||
return array(
|
||||
'nid' => $this->t('Node ID'),
|
||||
'bid' => $this->t('Book ID'),
|
||||
'mlid' => $this->t('Menu link ID'),
|
||||
'plid' => $this->t('Parent link ID'),
|
||||
'weight' => $this->t('Weight'),
|
||||
'p1' => $this->t('The first mlid in the materialized path.'),
|
||||
'p2' => $this->t('The second mlid in the materialized path.'),
|
||||
'p3' => $this->t('The third mlid in the materialized path.'),
|
||||
'p4' => $this->t('The fourth mlid in the materialized path.'),
|
||||
'p5' => $this->t('The fifth mlid in the materialized path.'),
|
||||
'p6' => $this->t('The sixth mlid in the materialized path.'),
|
||||
'p7' => $this->t('The seventh mlid in the materialized path.'),
|
||||
'p8' => $this->t('The eight mlid in the materialized path.'),
|
||||
'p9' => $this->t('The nine mlid in the materialized path.'),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Plugin\migrate\source\d6\Box.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Plugin\migrate\source\d6;
|
||||
|
||||
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
|
||||
|
||||
/**
|
||||
* Drupal 6 block source from database.
|
||||
*
|
||||
* @MigrateSource(
|
||||
* id = "d6_box"
|
||||
* )
|
||||
*/
|
||||
class Box extends DrupalSqlBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function query() {
|
||||
$query = $this->select('boxes', 'b')
|
||||
->fields('b', array('bid', 'body', 'info', 'format'));
|
||||
$query->orderBy('bid');
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fields() {
|
||||
return array(
|
||||
'bid' => $this->t('The numeric identifier of the block/box'),
|
||||
'body' => $this->t('The block/box content'),
|
||||
'info' => $this->t('Admin title of the block/box.'),
|
||||
'format' => $this->t('Input format of the custom block/box content.'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getIds() {
|
||||
$ids['bid']['type'] = 'integer';
|
||||
return $ids;
|
||||
}
|
||||
|
||||
}
|
|
@ -8,6 +8,7 @@
|
|||
namespace Drupal\migrate_drupal\Plugin\migrate\source\d6;
|
||||
|
||||
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
|
||||
use Drupal\migrate\Plugin\migrate\source\DummyQueryTrait;
|
||||
|
||||
/**
|
||||
* @MigrateSource(
|
||||
|
@ -16,6 +17,8 @@ use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
|
|||
*/
|
||||
class CommentVariable extends DrupalSqlBase {
|
||||
|
||||
use DummyQueryTrait;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
@ -92,13 +95,6 @@ class CommentVariable extends DrupalSqlBase {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function query() {
|
||||
// Nothing to do here.
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
@ -1,70 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Plugin\migrate\source\d6\ContactCategory.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Plugin\migrate\source\d6;
|
||||
|
||||
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
|
||||
use Drupal\migrate\Row;
|
||||
|
||||
/**
|
||||
* Drupal 6 contact category source from database.
|
||||
*
|
||||
* @MigrateSource(
|
||||
* id = "d6_contact_category",
|
||||
* source_provider = "contact"
|
||||
* )
|
||||
*/
|
||||
class ContactCategory extends DrupalSqlBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function query() {
|
||||
$query = $this->select('contact', 'c')
|
||||
->fields('c', array(
|
||||
'cid',
|
||||
'category',
|
||||
'recipients',
|
||||
'reply',
|
||||
'weight',
|
||||
'selected',
|
||||
)
|
||||
);
|
||||
$query->orderBy('cid');
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function prepareRow(Row $row) {
|
||||
$row->setSourceProperty('recipients', explode(',', $row->getSourceProperty('recipients')));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fields() {
|
||||
return array(
|
||||
'cid' => $this->t('Primary Key: Unique category ID.'),
|
||||
'category' => $this->t('Category name.'),
|
||||
'recipients' => $this->t('Comma-separated list of recipient email addresses.'),
|
||||
'reply' => $this->t('Text of the auto-reply message.'),
|
||||
'weight' => $this->t("The category's weight."),
|
||||
'selected' => $this->t('Flag to indicate whether or not category is selected by default. (1 = Yes, 0 = No)'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getIds() {
|
||||
$ids['cid']['type'] = 'integer';
|
||||
return $ids;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Plugin\migrate\source\d6\ContactSettings.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Plugin\migrate\source\d6;
|
||||
use Drupal\migrate_drupal\Plugin\migrate\source\Variable;
|
||||
|
||||
/**
|
||||
* @MigrateSource(
|
||||
* id = "d6_contact_settings",
|
||||
* source_provider = "contact"
|
||||
* )
|
||||
*/
|
||||
class ContactSettings extends Variable {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
function initializeIterator() {
|
||||
$default_category = $this->select('contact', 'c')
|
||||
->fields('c', array('cid'))
|
||||
->condition('selected', 1)
|
||||
->execute()
|
||||
->fetchField();
|
||||
return new \ArrayIterator(array($this->values() + array('default_category' => $default_category)));
|
||||
}
|
||||
|
||||
}
|
|
@ -7,6 +7,8 @@
|
|||
|
||||
namespace Drupal\migrate_drupal\Plugin\migrate\source\d6;
|
||||
|
||||
use Drupal\node\Plugin\migrate\source\d6\ViewModeBase;
|
||||
|
||||
/**
|
||||
* The field instance per view mode source class.
|
||||
*
|
||||
|
|
|
@ -1,102 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Plugin\migrate\source\d6\FilterFormat.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Plugin\migrate\source\d6;
|
||||
|
||||
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
|
||||
use Drupal\migrate\Row;
|
||||
|
||||
/**
|
||||
* Drupal 6 role source from database.
|
||||
*
|
||||
* @MigrateSource(
|
||||
* id = "d6_filter_format"
|
||||
* )
|
||||
*/
|
||||
class FilterFormat extends DrupalSqlBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function query() {
|
||||
$query = $this->select('filter_formats', 'f')
|
||||
->fields('f', array('format', 'name', 'roles', 'cache'))
|
||||
->orderBy('format');
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fields() {
|
||||
return array(
|
||||
'format' => $this->t('Format ID.'),
|
||||
'name' => $this->t('The name of the filter format.'),
|
||||
'roles' => $this->t('The user roles that can use the format.'),
|
||||
'cache' => $this->t('Flag to indicate whether format is cacheable. (1 = cacheable, 0 = not cacheable).'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function prepareRow(Row $row) {
|
||||
$filters = array();
|
||||
$roles = $row->getSourceProperty('roles');
|
||||
$row->setSourceProperty('roles', array_values(array_filter(explode(',', $roles))));
|
||||
$format = $row->getSourceProperty('format');
|
||||
// Find filters for this row.
|
||||
$results = $this->database
|
||||
->select('filters', 'f', array('fetch' => \PDO::FETCH_ASSOC))
|
||||
->fields('f', array('module', 'delta', 'weight'))
|
||||
->condition('format', $format)
|
||||
->execute();
|
||||
foreach ($results as $raw_filter) {
|
||||
$module = $raw_filter['module'];
|
||||
$delta = $raw_filter['delta'];
|
||||
$filter = array(
|
||||
'module' => $module,
|
||||
'delta' => $delta,
|
||||
'weight' => $raw_filter['weight'],
|
||||
'settings' => array(),
|
||||
);
|
||||
// Load the filter settings for the filter module, modules can use
|
||||
// hook_migration_d6_filter_formats_prepare_row() to add theirs.
|
||||
if ($raw_filter['module'] == 'filter') {
|
||||
if (!$delta) {
|
||||
if ($setting = $this->variableGet("allowed_html_$format", NULL)) {
|
||||
$filter['settings']['allowed_html'] = $setting;
|
||||
}
|
||||
if ($setting = $this->variableGet("filter_html_help_$format", NULL)) {
|
||||
$filter['settings']['filter_html_help'] = $setting;
|
||||
}
|
||||
if ($setting = $this->variableGet("filter_html_nofollow_$format", NULL)) {
|
||||
$filter['settings']['filter_html_nofollow'] = $setting;
|
||||
}
|
||||
}
|
||||
elseif ($delta == 2 && ($setting = $this->variableGet("filter_url_length_$format", NULL))) {
|
||||
$filter['settings']['filter_url_length'] = $setting;
|
||||
}
|
||||
}
|
||||
$filters[] = $filter;
|
||||
}
|
||||
|
||||
$row->setSourceProperty('filters', $filters);
|
||||
return parent::prepareRow($row);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getIds() {
|
||||
$ids['format']['type'] = 'integer';
|
||||
return $ids;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Plugin\migrate\source\d6\Menu.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Plugin\migrate\source\d6;
|
||||
|
||||
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
|
||||
|
||||
/**
|
||||
* Drupal 6 menu source from database.
|
||||
*
|
||||
* @MigrateSource(
|
||||
* id = "d6_menu",
|
||||
* source_provider = "menu"
|
||||
* )
|
||||
*/
|
||||
class Menu extends DrupalSqlBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function query() {
|
||||
$query = $this->select('menu_custom', 'm')
|
||||
->fields('m', array('menu_name', 'title', 'description'));
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fields() {
|
||||
return array(
|
||||
'menu_name' => $this->t('The menu name. Primary key.'),
|
||||
'title' => $this->t('The human-readable name of the menu.'),
|
||||
'description' => $this->t('A description of the menu'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getIds() {
|
||||
$ids['menu_name']['type'] = 'string';
|
||||
return $ids;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,110 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Plugin\migrate\source\d6\MenuLink.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Plugin\migrate\source\d6;
|
||||
|
||||
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
|
||||
use Drupal\migrate\Row;
|
||||
|
||||
/**
|
||||
* Drupal 6 menu link source from database.
|
||||
*
|
||||
* @MigrateSource(
|
||||
* id = "d6_menu_link",
|
||||
* )
|
||||
*/
|
||||
class MenuLink extends DrupalSqlBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function query() {
|
||||
$query = $this->select('menu_links', 'ml')
|
||||
->fields('ml', array(
|
||||
'menu_name',
|
||||
'mlid',
|
||||
'plid',
|
||||
'link_path',
|
||||
'router_path',
|
||||
'link_title',
|
||||
'options',
|
||||
'module',
|
||||
'hidden',
|
||||
'external',
|
||||
'has_children',
|
||||
'expanded',
|
||||
'weight',
|
||||
'depth',
|
||||
'customized',
|
||||
'p1',
|
||||
'p2',
|
||||
'p3',
|
||||
'p4',
|
||||
'p5',
|
||||
'p6',
|
||||
'p7',
|
||||
'p8',
|
||||
'p9',
|
||||
'updated'
|
||||
))
|
||||
->condition('module', 'menu')
|
||||
->condition('customized', 1);
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fields() {
|
||||
return array(
|
||||
'menu_name' => t("The menu name. All links with the same menu name (such as 'navigation') are part of the same menu."),
|
||||
'mlid' => t('The menu link ID (mlid) is the integer primary key.'),
|
||||
'plid' => t('The parent link ID (plid) is the mlid of the link above in the hierarchy, or zero if the link is at the top level in its menu.'),
|
||||
'link_path' => t('The Drupal path or external path this link points to.'),
|
||||
'router_path' => t('For links corresponding to a Drupal path (external = 0), this connects the link to a {menu_router}.path for joins.'),
|
||||
'link_title' => t('The text displayed for the link, which may be modified by a title callback stored in {menu_router}.'),
|
||||
'options' => t('A serialized array of options to be passed to the url() or l() function, such as a query string or HTML attributes.'),
|
||||
'module' => t('The name of the module that generated this link.'),
|
||||
'hidden' => t('A flag for whether the link should be rendered in menus. (1 = a disabled menu item that may be shown on admin screens, -1 = a menu callback, 0 = a normal, visible link)'),
|
||||
'external' => t('A flag to indicate if the link points to a full URL starting with a protocol, like http:// (1 = external, 0 = internal).'),
|
||||
'has_children' => t('Flag indicating whether any links have this link as a parent (1 = children exist, 0 = no children).'),
|
||||
'expanded' => t('Flag for whether this link should be rendered as expanded in menus - expanded links always have their child links displayed, instead of only when the link is in the active trail (1 = expanded, 0 = not expanded)'),
|
||||
'weight' => t('Link weight among links in the same menu at the same depth.'),
|
||||
'depth' => t('The depth relative to the top level. A link with plid == 0 will have depth == 1.'),
|
||||
'customized' => t('A flag to indicate that the user has manually created or edited the link (1 = customized, 0 = not customized).'),
|
||||
'p1' => t('The first mlid in the materialized path. If N = depth, then pN must equal the mlid. If depth > 1 then p(N-1) must equal the plid. All pX where X > depth must equal zero. The columns p1 .. p9 are also called the parents.'),
|
||||
'p2' => t('The second mlid in the materialized path. See p1.'),
|
||||
'p3' => t('The third mlid in the materialized path. See p1.'),
|
||||
'p4' => t('The fourth mlid in the materialized path. See p1.'),
|
||||
'p5' => t('The fifth mlid in the materialized path. See p1.'),
|
||||
'p6' => t('The sixth mlid in the materialized path. See p1.'),
|
||||
'p7' => t('The seventh mlid in the materialized path. See p1.'),
|
||||
'p8' => t('The eighth mlid in the materialized path. See p1.'),
|
||||
'p9' => t('The ninth mlid in the materialized path. See p1.'),
|
||||
'updated' => t('Flag that indicates that this link was generated during the update from Drupal 5.'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function prepareRow(Row $row) {
|
||||
$row->setSourceProperty('options', unserialize($row->getSourceProperty('options')));
|
||||
$row->setSourceProperty('enabled', !$row->getSourceProperty('hidden'));
|
||||
|
||||
return parent::prepareRow($row);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getIds() {
|
||||
$ids['mlid']['type'] = 'integer';
|
||||
return $ids;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,144 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Plugin\migrate\source\d6\Node.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Plugin\migrate\source\d6;
|
||||
|
||||
use Drupal\migrate\Row;
|
||||
use Drupal\migrate\Plugin\SourceEntityInterface;
|
||||
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
|
||||
|
||||
/**
|
||||
* Drupal 6 node source from database.
|
||||
*
|
||||
* @MigrateSource(
|
||||
* id = "d6_node"
|
||||
* )
|
||||
*/
|
||||
class Node extends DrupalSqlBase implements SourceEntityInterface {
|
||||
|
||||
/**
|
||||
* The join options between the node and the node_revisions table.
|
||||
*/
|
||||
const JOIN = 'n.vid = nr.vid';
|
||||
|
||||
/**
|
||||
* The default filter format.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $filterDefaultFormat;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function query() {
|
||||
// Select node in its last revision.
|
||||
$query = $this->select('node_revisions', 'nr')
|
||||
->fields('n', array(
|
||||
'nid',
|
||||
'type',
|
||||
'language',
|
||||
'status',
|
||||
'created',
|
||||
'changed',
|
||||
'comment',
|
||||
'promote',
|
||||
'moderate',
|
||||
'sticky',
|
||||
'tnid',
|
||||
'translate',
|
||||
))
|
||||
->fields('nr', array(
|
||||
'vid',
|
||||
'title',
|
||||
'body',
|
||||
'teaser',
|
||||
'log',
|
||||
'timestamp',
|
||||
'format',
|
||||
));
|
||||
$query->addField('n', 'uid', 'node_uid');
|
||||
$query->addField('nr', 'uid', 'revision_uid');
|
||||
$query->innerJoin('node', 'n', static::JOIN);
|
||||
|
||||
if (isset($this->configuration['node_type'])) {
|
||||
$query->condition('type', $this->configuration['node_type']);
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function initializeIterator() {
|
||||
$this->filterDefaultFormat = $this->variableGet('filter_default_format', '1');
|
||||
return parent::initializeIterator();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fields() {
|
||||
$fields = array(
|
||||
'nid' => $this->t('Node ID'),
|
||||
'type' => $this->t('Type'),
|
||||
'title' => $this->t('Title'),
|
||||
'body' => $this->t('Body'),
|
||||
'format' => $this->t('Format'),
|
||||
'teaser' => $this->t('Teaser'),
|
||||
'node_uid' => $this->t('Node authored by (uid)'),
|
||||
'revision_uid' => $this->t('Revision authored by (uid)'),
|
||||
'created' => $this->t('Created timestamp'),
|
||||
'changed' => $this->t('Modified timestamp'),
|
||||
'status' => $this->t('Published'),
|
||||
'promote' => $this->t('Promoted to front page'),
|
||||
'sticky' => $this->t('Sticky at top of lists'),
|
||||
'revision' => $this->t('Create new revision'),
|
||||
'language' => $this->t('Language (fr, en, ...)'),
|
||||
'tnid' => $this->t('The translation set id for this node'),
|
||||
'timestamp' => $this->t('The timestamp the latest revision of this node was created.'),
|
||||
);
|
||||
return $fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function prepareRow(Row $row) {
|
||||
// format = 0 can happen when the body field is hidden. Set the format to 1
|
||||
// to avoid migration map issues (since the body field isn't used anyway).
|
||||
if ($row->getSourceProperty('format') === '0') {
|
||||
$row->setSourceProperty('format', $this->filterDefaultFormat);
|
||||
}
|
||||
return parent::prepareRow($row);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getIds() {
|
||||
$ids['nid']['type'] = 'integer';
|
||||
$ids['nid']['alias'] = 'n';
|
||||
return $ids;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function bundleMigrationRequired() {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function entityTypeId() {
|
||||
return 'node';
|
||||
}
|
||||
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Plugin\migrate\source\d6\NodeRevision.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Plugin\migrate\source\d6;
|
||||
|
||||
/**
|
||||
* Drupal 6 node revision source from database.
|
||||
*
|
||||
* @MigrateSource(
|
||||
* id = "d6_node_revision"
|
||||
* )
|
||||
*/
|
||||
class NodeRevision extends Node {
|
||||
|
||||
/**
|
||||
* The join options between the node and the node_revisions_table.
|
||||
*/
|
||||
const JOIN = 'n.nid = nr.nid AND n.vid <> nr.vid';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fields() {
|
||||
// Use all the node fields plus the vid that identifies the version.
|
||||
return parent::fields() + array(
|
||||
'vid' => t('The primary identifier for this version.'),
|
||||
'log' => $this->t('Revision Log message'),
|
||||
'timestamp' => $this->t('Revision timestamp'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getIds() {
|
||||
$ids['vid']['type'] = 'integer';
|
||||
$ids['vid']['alias'] = 'nr';
|
||||
return $ids;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,126 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Plugin\migrate\source\d6\NodeType.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Plugin\migrate\source\d6;
|
||||
|
||||
use Drupal\migrate\Row;
|
||||
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
|
||||
|
||||
/**
|
||||
* Drupal 6 Node types source from database.
|
||||
*
|
||||
* @MigrateSource(
|
||||
* id = "d6_node_type"
|
||||
* )
|
||||
*/
|
||||
class NodeType extends DrupalSqlBase {
|
||||
|
||||
/**
|
||||
* The teaser length
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $teaserLength;
|
||||
|
||||
/**
|
||||
* Node preview optional / required.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $nodePreview;
|
||||
|
||||
/**
|
||||
* An array of theme settings.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $themeSettings;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function query() {
|
||||
return $this->select('node_type', 't')
|
||||
->fields('t', array(
|
||||
'type',
|
||||
'name',
|
||||
'module',
|
||||
'description',
|
||||
'help',
|
||||
'title_label',
|
||||
'has_body',
|
||||
'body_label',
|
||||
'min_word_count',
|
||||
'custom',
|
||||
'modified',
|
||||
'locked',
|
||||
'orig_type',
|
||||
))
|
||||
->orderBy('t.type');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fields() {
|
||||
return array(
|
||||
'type' => $this->t('Machine name of the node type.'),
|
||||
'name' => $this->t('Human name of the node type.'),
|
||||
'module' => $this->t('The module providing the node type.'),
|
||||
'description' => $this->t('Description of the node type.'),
|
||||
'help' => $this->t('Help text for the node type.'),
|
||||
'title_label' => $this->t('Title label.'),
|
||||
'has_body' => $this->t('Flag indicating the node type has a body field.'),
|
||||
'body_label' => $this->t('Body label.'),
|
||||
'min_word_count' => $this->t('Minimum word count for the body field.'),
|
||||
'custom' => $this->t('Flag.'),
|
||||
'modified' => $this->t('Flag.'),
|
||||
'locked' => $this->t('Flag.'),
|
||||
'orig_type' => $this->t('The original type.'),
|
||||
'teaser_length' => $this->t('Teaser length'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function initializeIterator() {
|
||||
$this->teaserLength = $this->variableGet('teaser_length', 600);
|
||||
$this->nodePreview = $this->variableGet('node_preview', 0);
|
||||
$this->themeSettings = $this->variableGet('theme_settings', array());
|
||||
return parent::initializeIterator();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function prepareRow(Row $row) {
|
||||
$row->setSourceProperty('teaser_length', $this->teaserLength);
|
||||
$row->setSourceProperty('node_preview', $this->nodePreview);
|
||||
|
||||
$type = $row->getSourceProperty('type');
|
||||
$source_options = $this->variableGet('node_options_' . $type, array('promote', 'sticky'));
|
||||
$options = array();
|
||||
foreach (array('promote', 'sticky', 'status', 'revision') as $item) {
|
||||
$options[$item] = in_array($item, $source_options);
|
||||
}
|
||||
$row->setSourceProperty('options', $options);
|
||||
$submitted = isset($this->themeSettings['toggle_node_info_' . $type]) ? $this->themeSettings['toggle_node_info_' . $type] : FALSE;
|
||||
$row->setSourceProperty('display_submitted', $submitted);
|
||||
|
||||
return parent::prepareRow($row);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getIds() {
|
||||
$ids['type']['type'] = 'string';
|
||||
return $ids;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,79 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Plugin\migrate\source\d6\Term.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Plugin\migrate\source\d6;
|
||||
|
||||
use Drupal\migrate\Row;
|
||||
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
|
||||
|
||||
/**
|
||||
* Drupal 6 taxonomy terms source from database.
|
||||
*
|
||||
* @todo Support term_relation, term_synonym table if possible.
|
||||
*
|
||||
* @MigrateSource(
|
||||
* id = "d6_taxonomy_term",
|
||||
* source_provider = "taxonomy"
|
||||
* )
|
||||
*/
|
||||
class Term extends DrupalSqlBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function query() {
|
||||
// Note the explode - this supports the (admittedly unusual) case of
|
||||
// consolidating multiple vocabularies into one.
|
||||
$query = $this->select('term_data', 'td')
|
||||
->fields('td', array('tid', 'vid', 'name', 'description', 'weight'))
|
||||
// This works, but we cannot test that, because there is no support for
|
||||
// distinct() in FakeSelect, yet.
|
||||
->distinct()
|
||||
->orderBy('tid');
|
||||
if (isset($this->configuration['vocabulary'])) {
|
||||
$query->condition('vid', $this->configuration['vocabulary'], 'IN');
|
||||
}
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fields() {
|
||||
return array(
|
||||
'tid' => $this->t('The term ID.'),
|
||||
'vid' => $this->t('Existing term VID'),
|
||||
'name' => $this->t('The name of the term.'),
|
||||
'description' => $this->t('The term description.'),
|
||||
'weight' => $this->t('Weight'),
|
||||
'parent' => $this->t("The Drupal term IDs of the term's parents."),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function prepareRow(Row $row) {
|
||||
// Find parents for this row.
|
||||
$parents = $this->select('term_hierarchy', 'th')
|
||||
->fields('th', array('parent', 'tid'))
|
||||
->condition('tid', $row->getSourceProperty('tid'))
|
||||
->execute()
|
||||
->fetchCol();
|
||||
$row->setSourceProperty('parent', $parents);
|
||||
return parent::prepareRow($row);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getIds() {
|
||||
$ids['tid']['type'] = 'integer';
|
||||
return $ids;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,93 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Plugin\migrate\source\d6\TermNode.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Plugin\migrate\source\d6;
|
||||
|
||||
use Drupal\migrate\Plugin\SourceEntityInterface;
|
||||
use Drupal\migrate\Row;
|
||||
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
|
||||
|
||||
/**
|
||||
* Source returning tids from the term_node table for the current revision.
|
||||
*
|
||||
* @MigrateSource(
|
||||
* id = "d6_term_node",
|
||||
* source_provider = "taxonomy"
|
||||
* )
|
||||
*/
|
||||
class TermNode extends DrupalSqlBase implements SourceEntityInterface {
|
||||
|
||||
/**
|
||||
* The join options between the node and the term node table.
|
||||
*/
|
||||
const JOIN = 'tn.vid = n.vid';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function query() {
|
||||
$query = $this->select('term_node', 'tn')
|
||||
// @todo: working, but not is there support for distinct() in FakeSelect?
|
||||
->distinct()
|
||||
->fields('tn', array('nid', 'vid'))
|
||||
->fields('n', array('type'));
|
||||
// Because this is an inner join it enforces the current revision.
|
||||
$query->innerJoin('term_data', 'td', 'td.tid = tn.tid AND td.vid = :vid', array(':vid' => $this->configuration['vid']));
|
||||
$query->innerJoin('node', 'n', static::JOIN);
|
||||
return $query;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fields() {
|
||||
return array(
|
||||
'nid' => $this->t('The node revision ID.'),
|
||||
'vid' => $this->t('The node revision ID.'),
|
||||
'tid' => $this->t('The term ID.'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function prepareRow(Row $row) {
|
||||
// Select the terms belonging to the revision selected.
|
||||
$query = $this->select('term_node', 'tn')
|
||||
->fields('tn', array('tid'))
|
||||
->condition('n.nid', $row->getSourceProperty('nid'));
|
||||
$query->join('node', 'n', static::JOIN);
|
||||
$query->innerJoin('term_data', 'td', 'td.tid = tn.tid AND td.vid = :vid', array(':vid' => $this->configuration['vid']));
|
||||
$row->setSourceProperty('tid', $query->execute()->fetchCol());
|
||||
return parent::prepareRow($row);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getIds() {
|
||||
$ids['vid']['type'] = 'integer';
|
||||
$ids['vid']['alias'] = 'tn';
|
||||
return $ids;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function bundleMigrationRequired() {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function entityTypeId() {
|
||||
return 'taxonomy_term';
|
||||
}
|
||||
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Plugin\migrate\source\d6\TermNodeRevision.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Plugin\migrate\source\d6;
|
||||
|
||||
/**
|
||||
* Source returning tids from the term_node table for the non-current revision.
|
||||
*
|
||||
* @MigrateSource(
|
||||
* id = "d6_term_node_revision"
|
||||
* )
|
||||
*/
|
||||
class TermNodeRevision extends TermNode {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
const JOIN = 'tn.nid = n.nid AND tn.vid != n.vid';
|
||||
|
||||
}
|
|
@ -8,6 +8,7 @@
|
|||
namespace Drupal\migrate_drupal\Plugin\migrate\source\d6;
|
||||
|
||||
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
|
||||
use Drupal\migrate\Plugin\migrate\source\DummyQueryTrait;
|
||||
|
||||
/**
|
||||
* Drupal 6 upload instance source from database.
|
||||
|
@ -19,6 +20,8 @@ use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
|
|||
*/
|
||||
class UploadInstance extends DrupalSqlBase {
|
||||
|
||||
use DummyQueryTrait;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
@ -60,13 +63,6 @@ class UploadInstance extends DrupalSqlBase {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function query() {
|
||||
// Nothing needed here.
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
@ -78,4 +74,11 @@ class UploadInstance extends DrupalSqlBase {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function count() {
|
||||
return count($this->initializeIterator());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,51 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Plugin\migrate\source\d6\UrlAlias.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Plugin\migrate\source\d6;
|
||||
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
|
||||
|
||||
/**
|
||||
* Drupal 6 url aliases source from database.
|
||||
*
|
||||
* @MigrateSource(
|
||||
* id = "d6_url_alias"
|
||||
* )
|
||||
*/
|
||||
class UrlAlias extends DrupalSqlBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function query() {
|
||||
$query = $this->select('url_alias', 'ua')
|
||||
->fields('ua', array('pid', 'src', 'dst', 'language'));
|
||||
$query->orderBy('pid');
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fields() {
|
||||
return array(
|
||||
'pid' => $this->t('The numeric identifier of the path alias.'),
|
||||
'src' => $this->t('The internal path.'),
|
||||
'dst' => $this->t('The user set path alias.'),
|
||||
'language' => $this->t('The language code of the url alias.'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getIds() {
|
||||
$ids['pid']['type'] = 'integer';
|
||||
return $ids;
|
||||
}
|
||||
|
||||
}
|
|
@ -8,6 +8,7 @@
|
|||
namespace Drupal\migrate_drupal\Plugin\migrate\source\d6;
|
||||
|
||||
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
|
||||
use Drupal\migrate\Plugin\migrate\source\DummyQueryTrait;
|
||||
|
||||
/**
|
||||
* Drupal 6 user picture field instance source.
|
||||
|
@ -20,6 +21,8 @@ use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
|
|||
*/
|
||||
class UserPictureInstance extends DrupalSqlBase {
|
||||
|
||||
use DummyQueryTrait;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
@ -33,6 +36,15 @@ class UserPictureInstance extends DrupalSqlBase {
|
|||
)));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function count() {
|
||||
// This source provides a single row, corresponding to a single picture
|
||||
// field to be added to the user entity.
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
@ -52,11 +64,4 @@ class UserPictureInstance extends DrupalSqlBase {
|
|||
return $ids;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function query() {
|
||||
// Nothing to do here.
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,86 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Plugin\migrate\source\d6\ViewMode.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Plugin\migrate\source\d6;
|
||||
|
||||
use Drupal\Core\Entity\EntityManagerInterface;
|
||||
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
|
||||
use Drupal\migrate\Entity\MigrationInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
/**
|
||||
* The view mode source.
|
||||
*
|
||||
* @MigrateSource(
|
||||
* id = "d6_view_mode",
|
||||
* source_provider = "content"
|
||||
* )
|
||||
*/
|
||||
class ViewMode extends ViewModeBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function initializeIterator() {
|
||||
$rows = array();
|
||||
$result = $this->prepareQuery()->execute();
|
||||
while ($field_row = $result->fetchAssoc()) {
|
||||
$field_row['display_settings'] = unserialize($field_row['display_settings']);
|
||||
foreach ($this->getViewModes() as $view_mode) {
|
||||
if (isset($field_row['display_settings'][$view_mode]) && empty($field_row['display_settings'][$view_mode]['exclude'])) {
|
||||
if (!isset($rows[$view_mode])) {
|
||||
$rows[$view_mode]['entity_type'] = 'node';
|
||||
$rows[$view_mode]['view_mode'] = $view_mode;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new \ArrayIterator($rows);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function query() {
|
||||
$query = $this->select('content_node_field_instance', 'cnfi')
|
||||
->fields('cnfi', array(
|
||||
'display_settings',
|
||||
));
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fields() {
|
||||
return array(
|
||||
'display_settings' => $this->t('Serialize data with display settings.'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getIds() {
|
||||
$ids['view_mode']['type'] = 'string';
|
||||
return $ids;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function calculateDependencies() {
|
||||
$this->dependencies = parent::calculateDependencies();
|
||||
if (isset($this->configuration['constants']['targetEntityType'])) {
|
||||
$this->addDependency('module', $this->entityManager->getDefinition($this->configuration['constants']['targetEntityType'])->getProvider());
|
||||
}
|
||||
return $this->dependencies;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Plugin\migrate\source\d6\ViewModeBase.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Plugin\migrate\source\d6;
|
||||
|
||||
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
|
||||
|
||||
/**
|
||||
* A base class for migrations that require view mode info.
|
||||
*/
|
||||
abstract class ViewModeBase extends DrupalSqlBase {
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function count() {
|
||||
return count($this->initializeIterator());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of D6 view modes.
|
||||
*
|
||||
* Drupal 6 supported the following view modes.
|
||||
* NODE_BUILD_NORMAL = 0
|
||||
* NODE_BUILD_PREVIEW = 1
|
||||
* NODE_BUILD_SEARCH_INDEX = 2
|
||||
* NODE_BUILD_SEARCH_RESULT = 3
|
||||
* NODE_BUILD_RSS = 4
|
||||
* NODE_BUILD_PRINT = 5
|
||||
* teaser
|
||||
* full
|
||||
*
|
||||
* @return array
|
||||
* The view mode names.
|
||||
*/
|
||||
public function getViewModes() {
|
||||
return array(
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
'teaser',
|
||||
'full',
|
||||
);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Plugin\migrate\source\d6\Vocabulary.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Plugin\migrate\source\d6;
|
||||
|
||||
use Drupal\migrate\Row;
|
||||
|
||||
/**
|
||||
* Drupal 6 vocabularies source from database.
|
||||
*
|
||||
* @MigrateSource(
|
||||
* id = "d6_taxonomy_vocabulary",
|
||||
* source_provider = "taxonomy"
|
||||
* )
|
||||
*/
|
||||
class Vocabulary extends VocabularyBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function prepareRow(Row $row) {
|
||||
// Find node types for this row.
|
||||
$node_types = $this->select('vocabulary_node_types', 'nt')
|
||||
->fields('nt', array('type', 'vid'))
|
||||
->condition('vid', $row->getSourceProperty('vid'))
|
||||
->execute()
|
||||
->fetchCol();
|
||||
$row->setSourceProperty('node_types', $node_types);
|
||||
return parent::prepareRow($row);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getIds() {
|
||||
$ids['vid']['type'] = 'integer';
|
||||
return $ids;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Plugin\migrate\source\d6\VocabularyBase.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Plugin\migrate\source\d6;
|
||||
|
||||
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
|
||||
|
||||
/**
|
||||
* Drupal 6 vocabularies source base.
|
||||
*/
|
||||
abstract class VocabularyBase extends DrupalSqlBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function query() {
|
||||
$query = $this->select('vocabulary', 'v')
|
||||
->fields('v', array(
|
||||
'vid',
|
||||
'name',
|
||||
'description',
|
||||
'help',
|
||||
'relations',
|
||||
'hierarchy',
|
||||
'multiple',
|
||||
'required',
|
||||
'tags',
|
||||
'module',
|
||||
'weight',
|
||||
));
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fields() {
|
||||
return array(
|
||||
'vid' => $this->t('The vocabulary ID.'),
|
||||
'name' => $this->t('The name of the vocabulary.'),
|
||||
'description' => $this->t('The description of the vocabulary.'),
|
||||
'help' => $this->t('Help text to display for the vocabulary.'),
|
||||
'relations' => $this->t('Whether or not related terms are enabled within the vocabulary. (0 = disabled, 1 = enabled)'),
|
||||
'hierarchy' => $this->t('The type of hierarchy allowed within the vocabulary. (0 = disabled, 1 = single, 2 = multiple)'),
|
||||
'multiple' => $this->t('Whether or not multiple terms from this vocabulary may be assigned to a node. (0 = disabled, 1 = enabled)'),
|
||||
'required' => $this->t('Whether or not terms are required for nodes using this vocabulary. (0 = disabled, 1 = enabled)'),
|
||||
'tags' => $this->t('Whether or not free tagging is enabled for the vocabulary. (0 = disabled, 1 = enabled)'),
|
||||
'weight' => $this->t('The weight of the vocabulary in relation to other vocabularies.'),
|
||||
'parents' => $this->t("The Drupal term IDs of the term's parents."),
|
||||
'node_types' => $this->t('The names of the node types the vocabulary may be used with.'),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Plugin\migrate\source\d6\VocabularyPerType.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Plugin\migrate\source\d6;
|
||||
|
||||
/**
|
||||
* Gets all the vocabularies based on the node types that have Taxonomy enabled.
|
||||
*
|
||||
* @MigrateSource(
|
||||
* id = "d6_taxonomy_vocabulary_per_type",
|
||||
* source_provider = "taxonomy"
|
||||
* )
|
||||
*/
|
||||
class VocabularyPerType extends Vocabulary {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function query() {
|
||||
$query = parent::query();
|
||||
$query->fields('nt', array(
|
||||
'type',
|
||||
));
|
||||
$query->join('vocabulary_node_types', 'nt', 'v.vid = nt.vid');
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getIds() {
|
||||
$ids['vid']['type'] = 'integer';
|
||||
$ids['vid']['alias'] = 'nt';
|
||||
$ids['type']['type'] = 'string';
|
||||
return $ids;
|
||||
}
|
||||
|
||||
}
|
|
@ -8,6 +8,10 @@
|
|||
namespace Drupal\migrate_drupal\Tests;
|
||||
|
||||
use Drupal\migrate\Tests\MigrateTestBase;
|
||||
use Drupal\migrate\Entity\Migration;
|
||||
use Drupal\Component\Plugin\Exception\PluginNotFoundException;
|
||||
use Drupal\migrate\Plugin\migrate\source\SqlBase;
|
||||
use Drupal\Core\Database\Query\SelectInterface;
|
||||
|
||||
/**
|
||||
* Base class for Drupal migration tests.
|
||||
|
@ -26,7 +30,7 @@ abstract class MigrateDrupalTestBase extends MigrateTestBase {
|
|||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->loadDumps([$this->getDumpDirectory() . '/System.php']);
|
||||
$this->loadDumps(['System.php']);
|
||||
|
||||
$this->installEntitySchema('user');
|
||||
$this->installConfig(['migrate_drupal', 'system']);
|
||||
|
@ -42,4 +46,51 @@ abstract class MigrateDrupalTestBase extends MigrateTestBase {
|
|||
return __DIR__ . '/Table';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function loadDumps(array $files, $method = 'load') {
|
||||
$files = array_map(function($file) { return $this->getDumpDirectory() . '/' . $file; }, $files);
|
||||
parent::loadDumps($files, $method);
|
||||
}
|
||||
|
||||
/**
|
||||
* Turn all the migration templates for the specified drupal version into
|
||||
* real migration entities so we can test them.
|
||||
*
|
||||
* @param string $version
|
||||
* Drupal version as provided in migration_tags - e.g., 'Drupal 6'.
|
||||
*/
|
||||
protected function installMigrations($version) {
|
||||
$migration_templates = \Drupal::service('migrate.template_storage')->findTemplatesByTag($version);
|
||||
foreach ($migration_templates as $template) {
|
||||
try {
|
||||
$migration = Migration::create($template);
|
||||
$migration->save();
|
||||
}
|
||||
catch (PluginNotFoundException $e) {
|
||||
// Migrations requiring modules not enabled will throw an exception.
|
||||
// Ignoring this exception is equivalent to placing config in the
|
||||
// optional subdirectory - the migrations we require for the test will
|
||||
// be successfully saved.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that the source plugin provides a valid query and a valid count.
|
||||
*/
|
||||
public function testSourcePlugin() {
|
||||
if (isset($this->migration)) {
|
||||
$source = $this->migration->getSourcePlugin();
|
||||
// Make sure a SqlBase source has a valid query.
|
||||
if ($source instanceof SqlBase) {
|
||||
/** @var SqlBase $source */
|
||||
$this->assertTrue($source->query() instanceof SelectInterface, 'SQL source plugin has valid query');
|
||||
}
|
||||
// Validate that any source returns a valid count.
|
||||
$this->assertTrue(is_numeric($source->count()), 'Source plugin returns valid count');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,10 +7,6 @@
|
|||
|
||||
namespace Drupal\migrate_drupal\Tests;
|
||||
|
||||
use Drupal\Component\Utility\SafeMarkup;
|
||||
use Drupal\Core\Config\ExtensionInstallStorage;
|
||||
use Drupal\Core\Config\InstallStorage;
|
||||
use Drupal\Core\Config\StorageInterface;
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\simpletest\TestBase;
|
||||
|
||||
|
@ -19,6 +15,19 @@ use Drupal\simpletest\TestBase;
|
|||
*/
|
||||
abstract class MigrateFullDrupalTestBase extends MigrateDrupalTestBase {
|
||||
|
||||
/**
|
||||
* The test class which discovered migration tests must extend in order to be
|
||||
* included in this test run.
|
||||
*/
|
||||
const BASE_TEST_CLASS = 'Drupal\migrate_drupal\Tests\MigrateDrupalTestBase';
|
||||
|
||||
/**
|
||||
* A list of fully-qualified test classes which should be ignored.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $blacklist = [];
|
||||
|
||||
/**
|
||||
* Get the dump classes required for this migration test.
|
||||
*
|
||||
|
@ -31,9 +40,24 @@ abstract class MigrateFullDrupalTestBase extends MigrateDrupalTestBase {
|
|||
* Get the test classes that needs to be run for this test.
|
||||
*
|
||||
* @return array
|
||||
* The list of test fully-classified class names.
|
||||
* The list of fully-classified test class names.
|
||||
*/
|
||||
protected abstract function getTestClassesList();
|
||||
protected function getTestClassesList() {
|
||||
$classes = [];
|
||||
|
||||
$discovery = \Drupal::getContainer()->get('test_discovery');
|
||||
foreach (static::$modules as $module) {
|
||||
foreach ($discovery->getTestClasses($module) as $group) {
|
||||
foreach (array_keys($group) as $class) {
|
||||
if (is_subclass_of($class, static::BASE_TEST_CLASS)) {
|
||||
$classes[] = $class;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Exclude blacklisted classes.
|
||||
return array_diff($classes, static::$blacklist);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
@ -58,7 +82,6 @@ abstract class MigrateFullDrupalTestBase extends MigrateDrupalTestBase {
|
|||
$this->loadDumps($dumps);
|
||||
|
||||
$classes = $this->getTestClassesList();
|
||||
$extension_install_storage = new ExtensionInstallStorage(\Drupal::service('config.storage'), InstallStorage::CONFIG_OPTIONAL_DIRECTORY, StorageInterface::DEFAULT_COLLECTION, TRUE);
|
||||
foreach ($classes as $class) {
|
||||
if (is_subclass_of($class, '\Drupal\migrate\Tests\MigrateDumpAlterInterface')) {
|
||||
$class::migrateDumpAlter($this);
|
||||
|
@ -68,16 +91,6 @@ abstract class MigrateFullDrupalTestBase extends MigrateDrupalTestBase {
|
|||
// Run every migration in the order specified by the storage controller.
|
||||
foreach (entity_load_multiple('migration', static::$migrations) as $migration) {
|
||||
(new MigrateExecutable($migration, $this))->import();
|
||||
|
||||
// Ensure that the default migration has the correct dependencies.
|
||||
list($base_name, ) = explode(':', $migration->id(), 2);
|
||||
$default_configuration = $extension_install_storage->read('migrate.migration.' . $base_name);
|
||||
$default_dependencies = isset($default_configuration['dependencies']) ? $default_configuration['dependencies'] : [];
|
||||
$this->assertEqual($default_dependencies, $migration->getDependencies(), SafeMarkup::format('Dependencies in @id match after installing. Default configuration @first is equal to active configuration @second.', array(
|
||||
'@id' => $migration->id(),
|
||||
'@first' => var_export($default_dependencies, TRUE),
|
||||
'@second' => var_export($migration->getDependencies(), TRUE)
|
||||
)));
|
||||
}
|
||||
foreach ($classes as $class) {
|
||||
$test_object = new $class($this->testId);
|
||||
|
|
|
@ -49,6 +49,27 @@ class Variable extends DrupalDumpBase {
|
|||
))->values(array(
|
||||
'name' => 'admin_theme',
|
||||
'value' => 's:5:"seven";',
|
||||
))->values(array(
|
||||
'name' => 'aggregator_allowed_html_tags',
|
||||
'value' => 's:13:"<p> <div> <a>";',
|
||||
))->values(array(
|
||||
'name' => 'aggregator_clear',
|
||||
'value' => 'i:86400;',
|
||||
))->values(array(
|
||||
'name' => 'aggregator_fetcher',
|
||||
'value' => 's:10:"aggregator";',
|
||||
))->values(array(
|
||||
'name' => 'aggregator_parser',
|
||||
'value' => 's:10:"aggregator";',
|
||||
))->values(array(
|
||||
'name' => 'aggregator_processors',
|
||||
'value' => 'a:1:{i:0;s:10:"aggregator";}',
|
||||
))->values(array(
|
||||
'name' => 'aggregator_summary_items',
|
||||
'value' => 'i:6;',
|
||||
))->values(array(
|
||||
'name' => 'aggregator_teaser_length',
|
||||
'value' => 'i:500;',
|
||||
))->values(array(
|
||||
'name' => 'allow_insecure_derivatives',
|
||||
'value' => 'b:1;',
|
||||
|
@ -304,6 +325,15 @@ class Variable extends DrupalDumpBase {
|
|||
))->values(array(
|
||||
'name' => 'suppress_itok_output',
|
||||
'value' => 'b:1;',
|
||||
))->values(array(
|
||||
'name' => 'syslog_facility',
|
||||
'value' => 'i:8;',
|
||||
))->values(array(
|
||||
'name' => 'syslog_format',
|
||||
'value' => 's:72:"!base_url|!timestamp|!type|!ip|!request_uri|!referer|!uid|!link|!message";',
|
||||
))->values(array(
|
||||
'name' => 'syslog_identity',
|
||||
'value' => 's:6:"drupal";',
|
||||
))->values(array(
|
||||
'name' => 'theme_default',
|
||||
'value' => 's:6:"bartik";',
|
||||
|
@ -419,4 +449,4 @@ class Variable extends DrupalDumpBase {
|
|||
}
|
||||
|
||||
}
|
||||
#dfc4cdd451a6575677b8c10442893d26
|
||||
#5b6552f715939e2b33c22779e47e73e3
|
||||
|
|
|
@ -1,53 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Tests\d6\MigrateActionConfigsTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\config\Tests\SchemaCheckTestTrait;
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Upgrade variables to action.settings.yml.
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class MigrateActionConfigsTest extends MigrateDrupal6TestBase {
|
||||
|
||||
use SchemaCheckTestTrait;
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('action');
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$migration = entity_load('migration', 'd6_action_settings');
|
||||
$dumps = array(
|
||||
$this->getDumpDirectory() . '/Variable.php',
|
||||
);
|
||||
$this->prepare($migration, $dumps);
|
||||
$executable = new MigrateExecutable($migration, $this);
|
||||
$executable->import();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests migration of action variables to action.settings.yml.
|
||||
*/
|
||||
public function testActionSettings() {
|
||||
$config = $this->config('action.settings');
|
||||
$this->assertIdentical(35, $config->get('recursion_limit'));
|
||||
$this->assertConfigSchema(\Drupal::service('config.typed'), 'action.settings', $config->get());
|
||||
}
|
||||
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Tests\d6\MigrateAggregatorConfigsTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\config\Tests\SchemaCheckTestTrait;
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Upgrade variables to aggregator.settings.yml.
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class MigrateAggregatorConfigsTest extends MigrateDrupal6TestBase {
|
||||
|
||||
use SchemaCheckTestTrait;
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('aggregator');
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$migration = entity_load('migration', 'd6_aggregator_settings');
|
||||
$dumps = array(
|
||||
$this->getDumpDirectory() . '/Variable.php',
|
||||
);
|
||||
$this->prepare($migration, $dumps);
|
||||
$executable = new MigrateExecutable($migration, $this);
|
||||
$executable->import();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests migration of aggregator variables to aggregator.settings.yml.
|
||||
*/
|
||||
public function testAggregatorSettings() {
|
||||
$config = $this->config('aggregator.settings');
|
||||
$this->assertIdentical('aggregator', $config->get('fetcher'));
|
||||
$this->assertIdentical('aggregator', $config->get('parser'));
|
||||
$this->assertIdentical(array('aggregator'), $config->get('processors'));
|
||||
$this->assertIdentical(600, $config->get('items.teaser_length'));
|
||||
$this->assertIdentical('<a> <b> <br /> <dd> <dl> <dt> <em> <i> <li> <ol> <p> <strong> <u> <ul>', $config->get('items.allowed_html'));
|
||||
$this->assertIdentical(9676800, $config->get('items.expire'));
|
||||
$this->assertIdentical(3, $config->get('source.list_max'));
|
||||
$this->assertConfigSchema(\Drupal::service('config.typed'), 'aggregator.settings', $config->get());
|
||||
}
|
||||
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Tests\d6\MigrateAggregatorFeedTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\aggregator\Entity\Feed;
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Upgrade variables to aggregator_feed entities.
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class MigrateAggregatorFeedTest extends MigrateDrupal6TestBase {
|
||||
|
||||
static $modules = array('aggregator');
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->installEntitySchema('aggregator_feed');
|
||||
|
||||
$migration = entity_load('migration', 'd6_aggregator_feed');
|
||||
$dumps = array(
|
||||
$this->getDumpDirectory() . '/AggregatorFeed.php',
|
||||
);
|
||||
$this->prepare($migration, $dumps);
|
||||
$executable = new MigrateExecutable($migration, $this);
|
||||
$executable->import();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests migration of aggregator feeds.
|
||||
*/
|
||||
public function testAggregatorFeedImport() {
|
||||
/** @var Feed $feed */
|
||||
$feed = Feed::load(5);
|
||||
$this->assertNotNull($feed->uuid());
|
||||
$this->assertIdentical('Know Your Meme', $feed->title->value);
|
||||
$this->assertIdentical('en', $feed->language()->getId());
|
||||
$this->assertIdentical('http://knowyourmeme.com/newsfeed.rss', $feed->url->value);
|
||||
$this->assertIdentical('900', $feed->refresh->value);
|
||||
$this->assertIdentical('1387659487', $feed->checked->value);
|
||||
$this->assertIdentical('0', $feed->queued->value);
|
||||
$this->assertIdentical('http://knowyourmeme.com', $feed->link->value);
|
||||
$this->assertIdentical('New items added to the News Feed', $feed->description->value);
|
||||
$this->assertIdentical('http://b.thumbs.redditmedia.com/harEHsUUZVajabtC.png', $feed->image->value);
|
||||
$this->assertIdentical('"213cc1365b96c310e92053c5551f0504"', $feed->etag->value);
|
||||
$this->assertIdentical('0', $feed->modified->value);
|
||||
}
|
||||
}
|
|
@ -1,78 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Tests\d6\MigrateAggregatorItemTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\aggregator\Entity\Item;
|
||||
use Drupal\Core\Language\LanguageInterface;
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Upgrade aggregator items.
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class MigrateAggregatorItemTest extends MigrateDrupal6TestBase {
|
||||
|
||||
static $modules = array('aggregator');
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->installEntitySchema('aggregator_feed');
|
||||
$this->installEntitySchema('aggregator_item');
|
||||
|
||||
// Add some id mappings for the dependant migrations.
|
||||
$id_mappings = array(
|
||||
'd6_aggregator_feed' => array(
|
||||
array(array(5), array(5)),
|
||||
),
|
||||
);
|
||||
$this->prepareMigrations($id_mappings);
|
||||
|
||||
$entity = entity_create('aggregator_feed', array(
|
||||
'fid' => 5,
|
||||
'title' => 'Drupal Core',
|
||||
'url' => 'https://groups.drupal.org/not_used/167169',
|
||||
'refresh' => 900,
|
||||
'checked' => 1389919932,
|
||||
'description' => 'Drupal Core Group feed',
|
||||
));
|
||||
$entity->enforceIsNew();
|
||||
$entity->save();
|
||||
/** @var \Drupal\migrate\entity\Migration $migration */
|
||||
$migration = entity_load('migration', 'd6_aggregator_item');
|
||||
$dumps = array(
|
||||
$this->getDumpDirectory() . '/AggregatorItem.php',
|
||||
);
|
||||
$this->prepare($migration, $dumps);
|
||||
$executable = new MigrateExecutable($migration, $this);
|
||||
$executable->import();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Drupal 6 aggregator item migration to Drupal 8.
|
||||
*/
|
||||
public function testAggregatorItem() {
|
||||
/** @var Item $item */
|
||||
$item = Item::load(1);
|
||||
$this->assertIdentical('1', $item->id());
|
||||
$this->assertIdentical('5', $item->getFeedId());
|
||||
$this->assertIdentical('This (three) weeks in Drupal Core - January 10th 2014', $item->label());
|
||||
$this->assertIdentical('larowlan', $item->getAuthor());
|
||||
$this->assertIdentical("<h2 id='new'>What's new with Drupal 8?</h2>", $item->getDescription());
|
||||
$this->assertIdentical('https://groups.drupal.org/node/395218', $item->getLink());
|
||||
$this->assertIdentical('1389297196', $item->getPostedTime());
|
||||
$this->assertIdentical('en', $item->language()->getId());
|
||||
$this->assertIdentical('395218 at https://groups.drupal.org', $item->getGuid());
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,76 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Tests\d6\MigrateBlockContentTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\Core\Language\Language;
|
||||
use Drupal\block_content\Entity\BlockContent;
|
||||
use Drupal\Core\Language\LanguageInterface;
|
||||
use Drupal\field\Entity\FieldStorageConfig;
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Upgrade custom blocks.
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class MigrateBlockContentTest extends MigrateDrupal6TestBase {
|
||||
|
||||
static $modules = array('block', 'block_content', 'filter', 'text');
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->installConfig(array('block_content'));
|
||||
$this->installEntitySchema('block_content');
|
||||
|
||||
$migration = entity_load('migration', 'd6_block_content_type');
|
||||
$executable = new MigrateExecutable($migration, $this);
|
||||
$executable->import();
|
||||
$migration = entity_load('migration', 'd6_block_content_body_field');
|
||||
$executable = new MigrateExecutable($migration, $this);
|
||||
$executable->import();
|
||||
|
||||
$this->prepareMigrations(array(
|
||||
'd6_filter_format' => array(
|
||||
array(array(2), array('full_html'))
|
||||
)
|
||||
));
|
||||
/** @var \Drupal\migrate\entity\Migration $migration */
|
||||
$migration = entity_load('migration', 'd6_custom_block');
|
||||
$dumps = array(
|
||||
$this->getDumpDirectory() . '/Boxes.php',
|
||||
);
|
||||
$this->prepare($migration, $dumps);
|
||||
$executable = new MigrateExecutable($migration, $this);
|
||||
$executable->import();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the Drupal 6 custom block to Drupal 8 migration.
|
||||
*/
|
||||
public function testBlockMigration() {
|
||||
/** @var BlockContent $block */
|
||||
$block = BlockContent::load(1);
|
||||
$this->assertIdentical('My block 1', $block->label());
|
||||
$this->assertTrue(REQUEST_TIME <= $block->getChangedTime() && $block->getChangedTime() <= time());
|
||||
$this->assertIdentical('en', $block->language()->getId());
|
||||
$this->assertIdentical('<h3>My first custom block body</h3>', $block->body->value);
|
||||
$this->assertIdentical('full_html', $block->body->format);
|
||||
|
||||
$block = BlockContent::load(2);
|
||||
$this->assertIdentical('My block 2', $block->label());
|
||||
$this->assertTrue(REQUEST_TIME <= $block->getChangedTime() && $block->getChangedTime() <= time());
|
||||
$this->assertIdentical('en', $block->language()->getId());
|
||||
$this->assertIdentical('<h3>My second custom block body</h3>', $block->body->value);
|
||||
$this->assertIdentical('full_html', $block->body->format);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,192 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Tests\d6\MigrateBlockTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
use Drupal\block\Entity\Block;
|
||||
|
||||
/**
|
||||
* Upgrade block settings to block.block.*.yml.
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class MigrateBlockTest extends MigrateDrupal6TestBase {
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
static $modules = array(
|
||||
'block',
|
||||
'views',
|
||||
'comment',
|
||||
'menu_ui',
|
||||
'block_content',
|
||||
'node',
|
||||
);
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->installEntitySchema('block_content');
|
||||
|
||||
$entities = array(
|
||||
entity_create('menu', array('id' => 'primary-links')),
|
||||
entity_create('menu', array('id' => 'secondary-links')),
|
||||
entity_create('block_content', array('id' => 1, 'type' => 'basic', 'info' => $this->randomMachineName(8))),
|
||||
entity_create('block_content', array('id' => 2, 'type' => 'basic', 'info' => $this->randomMachineName(8))),
|
||||
);
|
||||
foreach ($entities as $entity) {
|
||||
$entity->enforceIsNew(TRUE);
|
||||
$entity->save();
|
||||
}
|
||||
$this->prepareMigrations(array(
|
||||
'd6_custom_block' => array(
|
||||
array(array(1), array(1)),
|
||||
array(array(2), array(2)),
|
||||
),
|
||||
'd6_menu' => array(
|
||||
array(array('menu1'), array('menu')),
|
||||
),
|
||||
'd6_user_role' => array(
|
||||
array(array(2), array('authenticated')),
|
||||
array(array(3), array('migrate_test_role_1')),
|
||||
),
|
||||
));
|
||||
|
||||
// Set Bartik and Seven as the default public and admin theme.
|
||||
$config = $this->config('system.theme');
|
||||
$config->set('default', 'bartik');
|
||||
$config->set('admin', 'seven');
|
||||
$config->save();
|
||||
|
||||
// Install one of D8's test themes.
|
||||
\Drupal::service('theme_handler')->install(array('test_theme'));
|
||||
|
||||
/** @var \Drupal\migrate\entity\Migration $migration */
|
||||
$migration = entity_load('migration', 'd6_block');
|
||||
$dumps = array(
|
||||
$this->getDumpDirectory() . '/Blocks.php',
|
||||
$this->getDumpDirectory() . '/BlocksRoles.php',
|
||||
$this->getDumpDirectory() . '/AggregatorFeed.php',
|
||||
);
|
||||
$this->prepare($migration, $dumps);
|
||||
$executable = new MigrateExecutable($migration, $this);
|
||||
$executable->import();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the block settings migration.
|
||||
*/
|
||||
public function testBlockMigration() {
|
||||
$blocks = Block::loadMultiple();
|
||||
$this->assertIdentical(count($blocks), 10);
|
||||
|
||||
// User blocks
|
||||
$test_block_user = $blocks['user'];
|
||||
$this->assertNotNull($test_block_user);
|
||||
$this->assertIdentical('sidebar_first', $test_block_user->getRegion());
|
||||
$this->assertIdentical('bartik', $test_block_user->getTheme());
|
||||
$visibility = $test_block_user->getVisibility();
|
||||
$this->assertTrue(empty($visibility));
|
||||
$this->assertIdentical(0, $test_block_user->getWeight());
|
||||
|
||||
$test_block_user_1 = $blocks['user_1'];
|
||||
$this->assertNotNull($test_block_user_1);
|
||||
$this->assertIdentical('sidebar_first', $test_block_user_1->getRegion());
|
||||
$this->assertIdentical('bartik', $test_block_user_1->getTheme());
|
||||
$visibility = $test_block_user_1->getVisibility();
|
||||
$this->assertTrue(empty($visibility));
|
||||
$this->assertIdentical(0, $test_block_user_1->getWeight());
|
||||
|
||||
$test_block_user_2 = $blocks['user_2'];
|
||||
$this->assertNotNull($test_block_user_2);
|
||||
$this->assertIdentical('sidebar_second', $test_block_user_2->getRegion());
|
||||
$this->assertIdentical('bartik', $test_block_user_2->getTheme());
|
||||
$visibility = $test_block_user_2->getVisibility();
|
||||
$this->assertIdentical($visibility['user_role']['id'], 'user_role');
|
||||
$roles = array();
|
||||
$roles['authenticated'] = 'authenticated';
|
||||
$this->assertIdentical($visibility['user_role']['roles'], $roles);
|
||||
$this->assertFalse($visibility['user_role']['negate']);
|
||||
$this->assertIdentical(-9, $test_block_user_2->getWeight());
|
||||
|
||||
$test_block_user_3 = $blocks['user_3'];
|
||||
$this->assertNotNull($test_block_user_3);
|
||||
$this->assertIdentical('sidebar_second', $test_block_user_3->getRegion());
|
||||
$this->assertIdentical('bartik', $test_block_user_3->getTheme());
|
||||
$visibility = $test_block_user_3->getVisibility();
|
||||
$this->assertIdentical($visibility['user_role']['id'], 'user_role');
|
||||
$roles = array();
|
||||
$roles['migrate_test_role_1'] = 'migrate_test_role_1';
|
||||
$this->assertIdentical($visibility['user_role']['roles'], $roles);
|
||||
$this->assertFalse($visibility['user_role']['negate']);
|
||||
$this->assertIdentical(-6, $test_block_user_3->getWeight());
|
||||
|
||||
// Check system block
|
||||
$test_block_system = $blocks['system'];
|
||||
$this->assertNotNull($test_block_system);
|
||||
$this->assertIdentical('footer', $test_block_system->getRegion());
|
||||
$this->assertIdentical('bartik', $test_block_system->getTheme());
|
||||
$visibility = $test_block_system->getVisibility();
|
||||
$this->assertIdentical('request_path', $visibility['request_path']['id']);
|
||||
$this->assertIdentical('node/1', $visibility['request_path']['pages']);
|
||||
$this->assertTrue($visibility['request_path']['negate']);
|
||||
$this->assertIdentical(-5, $test_block_system->getWeight());
|
||||
|
||||
// Check menu blocks
|
||||
$test_block_menu = $blocks['menu'];
|
||||
$this->assertNotNull($test_block_menu);
|
||||
$this->assertIdentical('header', $test_block_menu->getRegion());
|
||||
$this->assertIdentical('bartik', $test_block_menu->getTheme());
|
||||
$visibility = $test_block_menu->getVisibility();
|
||||
$this->assertTrue(empty($visibility));
|
||||
$this->assertIdentical(-5, $test_block_menu->getWeight());
|
||||
|
||||
// Check custom blocks
|
||||
$test_block_block = $blocks['block'];
|
||||
$this->assertNotNull($test_block_block);
|
||||
$this->assertIdentical('content', $test_block_block->getRegion());
|
||||
$this->assertIdentical('bartik', $test_block_block->getTheme());
|
||||
$visibility = $test_block_block->getVisibility();
|
||||
$this->assertIdentical('request_path', $visibility['request_path']['id']);
|
||||
$this->assertIdentical('<front>', $visibility['request_path']['pages']);
|
||||
$this->assertFalse($visibility['request_path']['negate']);
|
||||
$this->assertIdentical(0, $test_block_block->getWeight());
|
||||
|
||||
$test_block_block_1 = $blocks['block_1'];
|
||||
$this->assertNotNull($test_block_block_1);
|
||||
$this->assertIdentical('right', $test_block_block_1->getRegion());
|
||||
$this->assertIdentical('bluemarine', $test_block_block_1->getTheme());
|
||||
$visibility = $test_block_block_1->getVisibility();
|
||||
$this->assertIdentical('request_path', $visibility['request_path']['id']);
|
||||
$this->assertIdentical('node', $visibility['request_path']['pages']);
|
||||
$this->assertFalse($visibility['request_path']['negate']);
|
||||
$this->assertIdentical(-4, $test_block_block_1->getWeight());
|
||||
|
||||
$test_block_block_2 = $blocks['block_2'];
|
||||
$this->assertNotNull($test_block_block_2);
|
||||
$this->assertIdentical('right', $test_block_block_2->getRegion());
|
||||
$this->assertIdentical('test_theme', $test_block_block_2->getTheme());
|
||||
$visibility = $test_block_block_2->getVisibility();
|
||||
$this->assertTrue(empty($visibility));
|
||||
$this->assertIdentical(-7, $test_block_block_2->getWeight());
|
||||
|
||||
$test_block_block_3 = $blocks['block_3'];
|
||||
$this->assertNotNull($test_block_block_3);
|
||||
$this->assertIdentical('left', $test_block_block_3->getRegion());
|
||||
$this->assertIdentical('test_theme', $test_block_block_3->getTheme());
|
||||
$visibility = $test_block_block_3->getVisibility();
|
||||
$this->assertTrue(empty($visibility));
|
||||
$this->assertIdentical(-2, $test_block_block_3->getWeight());
|
||||
}
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Tests\d6\MigrateBookConfigsTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\config\Tests\SchemaCheckTestTrait;
|
||||
use Drupal\migrate\MigrateMessage;
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Upgrade variables to book.settings.yml.
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class MigrateBookConfigsTest extends MigrateDrupal6TestBase {
|
||||
|
||||
use SchemaCheckTestTrait;
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('book', 'system', 'node', 'field', 'text', 'entity_reference');
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$migration = entity_load('migration', 'd6_book_settings');
|
||||
$dumps = array(
|
||||
$this->getDumpDirectory() . '/Variable.php',
|
||||
);
|
||||
$this->prepare($migration, $dumps);
|
||||
$executable = new MigrateExecutable($migration, new MigrateMessage());
|
||||
$executable->import();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests migration of book variables to book.settings.yml.
|
||||
*/
|
||||
public function testBookSettings() {
|
||||
$config = $this->config('book.settings');
|
||||
$this->assertIdentical('book', $config->get('child_type'));
|
||||
$this->assertIdentical('all pages', $config->get('block.navigation.mode'));
|
||||
$this->assertIdentical(array('book'), $config->get('allowed_types'));
|
||||
$this->assertConfigSchema(\Drupal::service('config.typed'), 'book.settings', $config->get());
|
||||
}
|
||||
|
||||
}
|
|
@ -1,87 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Tests\d6\MigrateBookTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
use Drupal\node\Entity\Node;
|
||||
|
||||
/**
|
||||
* Upgrade book structure.
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class MigrateBookTest extends MigrateDrupal6TestBase {
|
||||
|
||||
public static $modules = array('book', 'system', 'node', 'field', 'text', 'entity_reference', 'user');
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$this->installEntitySchema('node');
|
||||
$this->installSchema('book', array('book'));
|
||||
$this->installSchema('node', array('node_access'));
|
||||
|
||||
$id_mappings = array();
|
||||
for ($i = 4; $i <= 8; $i++) {
|
||||
$entity = entity_create('node', array(
|
||||
'type' => 'story',
|
||||
'title' => "Node $i",
|
||||
'nid' => $i,
|
||||
'status' => TRUE,
|
||||
));
|
||||
$entity->enforceIsNew();
|
||||
$entity->save();
|
||||
$id_mappings['d6_node'][] = array(array($i), array($i));
|
||||
}
|
||||
$this->prepareMigrations($id_mappings);
|
||||
// Load database dumps to provide source data.
|
||||
$dumps = array(
|
||||
$this->getDumpDirectory() . '/Book.php',
|
||||
$this->getDumpDirectory() . '/MenuLinks.php',
|
||||
);
|
||||
$this->loadDumps($dumps);
|
||||
// Migrate books..
|
||||
$migration = entity_load('migration', 'd6_book');
|
||||
$executable = new MigrateExecutable($migration, $this);
|
||||
$executable->import();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the Drupal 6 book structure to Drupal 8 migration.
|
||||
*/
|
||||
public function testBook() {
|
||||
$nodes = Node::loadMultiple(array(4, 5, 6, 7, 8));
|
||||
$this->assertIdentical('4', $nodes[4]->book['bid']);
|
||||
$this->assertIdentical('0', $nodes[4]->book['pid']);
|
||||
|
||||
$this->assertIdentical('4', $nodes[5]->book['bid']);
|
||||
$this->assertIdentical('4', $nodes[5]->book['pid']);
|
||||
|
||||
$this->assertIdentical('4', $nodes[6]->book['bid']);
|
||||
$this->assertIdentical('5', $nodes[6]->book['pid']);
|
||||
|
||||
$this->assertIdentical('4', $nodes[7]->book['bid']);
|
||||
$this->assertIdentical('5', $nodes[7]->book['pid']);
|
||||
|
||||
$this->assertIdentical('8', $nodes[8]->book['bid']);
|
||||
$this->assertIdentical('0', $nodes[8]->book['pid']);
|
||||
|
||||
$tree = \Drupal::service('book.manager')->bookTreeAllData(4);
|
||||
$this->assertIdentical('4', $tree['49990 Node 4 4']['link']['nid']);
|
||||
$this->assertIdentical('5', $tree['49990 Node 4 4']['below']['50000 Node 5 5']['link']['nid']);
|
||||
$this->assertIdentical('6', $tree['49990 Node 4 4']['below']['50000 Node 5 5']['below']['50000 Node 6 6']['link']['nid']);
|
||||
$this->assertIdentical('7', $tree['49990 Node 4 4']['below']['50000 Node 5 5']['below']['50000 Node 7 7']['link']['nid']);
|
||||
$this->assertIdentical(array(), $tree['49990 Node 4 4']['below']['50000 Node 5 5']['below']['50000 Node 6 6']['below']);
|
||||
$this->assertIdentical(array(), $tree['49990 Node 4 4']['below']['50000 Node 5 5']['below']['50000 Node 7 7']['below']);
|
||||
}
|
||||
|
||||
}
|
|
@ -8,6 +8,7 @@
|
|||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\node\Tests\Migrate\d6\MigrateNodeTestBase;
|
||||
|
||||
/**
|
||||
* CCK field revision migration.
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
|
||||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\Core\Database\Database;
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\node\Entity\Node;
|
||||
use Drupal\node\Tests\Migrate\d6\MigrateNodeTestBase;
|
||||
|
||||
/**
|
||||
* CCK field content migration.
|
||||
|
|
|
@ -7,11 +7,7 @@
|
|||
|
||||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\comment\Entity\Comment;
|
||||
use Drupal\comment\Tests\CommentTestTrait;
|
||||
use Drupal\Core\Language\LanguageInterface;
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Upgrade comments.
|
||||
|
@ -60,21 +56,16 @@ class MigrateCommentTest extends MigrateDrupal6TestBase {
|
|||
);
|
||||
$this->prepareMigrations($id_mappings);
|
||||
|
||||
/** @var \Drupal\migrate\entity\Migration $migration */
|
||||
$migration = entity_load('migration', 'd6_comment');
|
||||
|
||||
$dumps = array(
|
||||
$this->getDumpDirectory() . '/Node.php',
|
||||
$this->getDumpDirectory() . '/NodeRevisions.php',
|
||||
$this->getDumpDirectory() . '/ContentTypeStory.php',
|
||||
$this->getDumpDirectory() . '/ContentTypeTestPlanet.php',
|
||||
$this->getDumpDirectory() . '/Variable.php',
|
||||
$this->getDumpDirectory() . '/NodeType.php',
|
||||
$this->getDumpDirectory() . '/Comments.php',
|
||||
);
|
||||
$this->prepare($migration, $dumps);
|
||||
$executable = new MigrateExecutable($migration, $this);
|
||||
$executable->import();
|
||||
$this->loadDumps([
|
||||
'Node.php',
|
||||
'NodeRevisions.php',
|
||||
'ContentTypeStory.php',
|
||||
'ContentTypeTestPlanet.php',
|
||||
'Variable.php',
|
||||
'NodeType.php',
|
||||
'Comments.php',
|
||||
]);
|
||||
$this->executeMigration('d6_comment');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\comment\Entity\CommentType;
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Upgrade comment type.
|
||||
|
@ -30,16 +28,8 @@ class MigrateCommentTypeTest extends MigrateDrupal6TestBase {
|
|||
$this->installEntitySchema('comment');
|
||||
$this->installConfig(['node', 'comment']);
|
||||
|
||||
/** @var \Drupal\migrate\entity\Migration $migration */
|
||||
$migration = entity_load('migration', 'd6_comment_type');
|
||||
|
||||
$dumps = array(
|
||||
$this->getDumpDirectory() . '/Variable.php',
|
||||
$this->getDumpDirectory() . '/NodeType.php',
|
||||
);
|
||||
$this->prepare($migration, $dumps);
|
||||
$executable = new MigrateExecutable($migration, $this);
|
||||
$executable->import();
|
||||
$this->loadDumps(['Variable.php', 'NodeType.php']);
|
||||
$this->executeMigration('d6_comment_type');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -7,9 +7,6 @@
|
|||
|
||||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Base class for Drupal 6 comment variables to Drupal 8 entity display tests.
|
||||
*/
|
||||
|
@ -30,13 +27,6 @@ abstract class MigrateCommentVariableDisplayBase extends MigrateDrupal6TestBase
|
|||
*/
|
||||
static $modules = array('comment', 'node');
|
||||
|
||||
/**
|
||||
* The database dumps used.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $dumps;
|
||||
|
||||
/**
|
||||
* The node types being tested.
|
||||
*
|
||||
|
@ -66,21 +56,14 @@ abstract class MigrateCommentVariableDisplayBase extends MigrateDrupal6TestBase
|
|||
'required' => 1,
|
||||
))->save();
|
||||
}
|
||||
$this->dumps = array(
|
||||
$this->getDumpDirectory() . '/Variable.php',
|
||||
$this->getDumpDirectory() . '/NodeType.php',
|
||||
);
|
||||
$id_mappings = array(
|
||||
'd6_comment_field_instance' => array(
|
||||
array(array('page'), array('node', 'comment', 'page')),
|
||||
),
|
||||
);
|
||||
$this->prepareMigrations($id_mappings);
|
||||
/** @var \Drupal\migrate\entity\Migration $migration */
|
||||
$migration = entity_load('migration', static::MIGRATION);
|
||||
$this->prepare($migration, $this->dumps);
|
||||
$executable = new MigrateExecutable($migration, $this);
|
||||
$executable->import();
|
||||
$this->loadDumps(['Variable.php', 'NodeType.php']);
|
||||
$this->executeMigration(static::MIGRATION);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -7,9 +7,6 @@
|
|||
|
||||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Upgrade comment subject variable to core.entity_form_display.comment.*.default.yml
|
||||
*
|
||||
|
@ -43,15 +40,8 @@ class MigrateCommentVariableEntityFormDisplaySubjectTest extends MigrateDrupal6T
|
|||
),
|
||||
);
|
||||
$this->prepareMigrations($id_mappings);
|
||||
/** @var \Drupal\migrate\entity\Migration $migration */
|
||||
$migration = entity_load('migration', 'd6_comment_entity_form_display_subject');
|
||||
$dumps = array(
|
||||
$this->getDumpDirectory() . '/Variable.php',
|
||||
$this->getDumpDirectory() . '/NodeType.php',
|
||||
);
|
||||
$this->prepare($migration, $dumps);
|
||||
$executable = new MigrateExecutable($migration, $this);
|
||||
$executable->import();
|
||||
$this->loadDumps(['Variable.php', 'NodeType.php']);
|
||||
$this->executeMigration('d6_comment_entity_form_display_subject');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\field\Entity\FieldStorageConfig;
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Upgrade comment variables to field.storage.node.comment.yml.
|
||||
|
@ -42,15 +40,8 @@ class MigrateCommentVariableFieldTest extends MigrateDrupal6TestBase {
|
|||
),
|
||||
);
|
||||
$this->prepareMigrations($id_mappings);
|
||||
/** @var \Drupal\migrate\entity\Migration $migration */
|
||||
$migration = entity_load('migration', 'd6_comment_field');
|
||||
$dumps = array(
|
||||
$this->getDumpDirectory() . '/Variable.php',
|
||||
$this->getDumpDirectory() . '/NodeType.php',
|
||||
);
|
||||
$this->prepare($migration, $dumps);
|
||||
$executable = new MigrateExecutable($migration, $this);
|
||||
$executable->import();
|
||||
$this->loadDumps(['Variable.php', 'NodeType.php']);
|
||||
$this->executeMigration('d6_comment_field');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -7,9 +7,6 @@
|
|||
|
||||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Upgrade comment variables to field.instance.node.*.comment.yml.
|
||||
*
|
||||
|
@ -50,15 +47,8 @@ class MigrateCommentVariableInstanceTest extends MigrateDrupal6TestBase {
|
|||
'type' => 'comment',
|
||||
'translatable' => '0',
|
||||
))->save();
|
||||
/** @var \Drupal\migrate\entity\Migration $migration */
|
||||
$migration = entity_load('migration', 'd6_comment_field_instance');
|
||||
$dumps = array(
|
||||
$this->getDumpDirectory() . '/Variable.php',
|
||||
$this->getDumpDirectory() . '/NodeType.php',
|
||||
);
|
||||
$this->prepare($migration, $dumps);
|
||||
$executable = new MigrateExecutable($migration, $this);
|
||||
$executable->import();
|
||||
$this->loadDumps(['Variable.php', 'NodeType.php']);
|
||||
$this->executeMigration('d6_comment_field_instance');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,67 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Tests\d6\MigrateContactCategoryTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\contact\Entity\ContactForm;
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\migrate\MigrateMessage;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Migrate contact categories to contact.form.*.yml.
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class MigrateContactCategoryTest extends MigrateDrupal6TestBase {
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('contact');
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$migration = entity_load('migration', 'd6_contact_category');
|
||||
$dumps = array(
|
||||
$this->getDumpDirectory() . '/Contact.php',
|
||||
);
|
||||
$this->prepare($migration, $dumps);
|
||||
$executable = new MigrateExecutable($migration, new MigrateMessage());
|
||||
$executable->import();
|
||||
}
|
||||
|
||||
/**
|
||||
* The Drupal 6 contact categories to Drupal 8 migration.
|
||||
*/
|
||||
public function testContactCategory() {
|
||||
/** @var \Drupal\contact\Entity\ContactForm $contact_form */
|
||||
$contact_form = ContactForm::load('website_feedback');
|
||||
$this->assertIdentical('Website feedback', $contact_form->label());
|
||||
$this->assertIdentical(array('admin@example.com'), $contact_form->getRecipients());
|
||||
$this->assertIdentical('', $contact_form->getReply());
|
||||
$this->assertIdentical(0, $contact_form->getWeight());
|
||||
|
||||
$contact_form = ContactForm::load('some_other_category');
|
||||
$this->assertIdentical('Some other category', $contact_form->label());
|
||||
$this->assertIdentical(array('test@example.com'), $contact_form->getRecipients());
|
||||
$this->assertIdentical('Thanks for contacting us, we will reply ASAP!', $contact_form->getReply());
|
||||
$this->assertIdentical(1, $contact_form->getWeight());
|
||||
|
||||
$contact_form = ContactForm::load('a_category_much_longer_than_thir');
|
||||
$this->assertIdentical('A category much longer than thirty two characters', $contact_form->label());
|
||||
$this->assertIdentical(array('fortyninechars@example.com'), $contact_form->getRecipients());
|
||||
$this->assertIdentical('', $contact_form->getReply());
|
||||
$this->assertIdentical(2, $contact_form->getWeight());
|
||||
}
|
||||
|
||||
}
|
|
@ -1,65 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Tests\d6\MigrateContactConfigsTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\config\Tests\SchemaCheckTestTrait;
|
||||
use Drupal\migrate\MigrateMessage;
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Upgrade variables to contact.settings.yml.
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class MigrateContactConfigsTest extends MigrateDrupal6TestBase {
|
||||
|
||||
use SchemaCheckTestTrait;
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('contact');
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
// Add some id mappings for the dependent migrations.
|
||||
$id_mappings = array(
|
||||
'd6_contact_category' => array(
|
||||
array(array(1), array('website_feedback')),
|
||||
array(array(2), array('some_other_category')),
|
||||
),
|
||||
);
|
||||
$this->prepareMigrations($id_mappings);
|
||||
$migration = entity_load('migration', 'd6_contact_settings');
|
||||
$dumps = array(
|
||||
$this->getDumpDirectory() . '/Variable.php',
|
||||
$this->getDumpDirectory() . '/Contact.php',
|
||||
);
|
||||
$this->prepare($migration, $dumps);
|
||||
$executable = new MigrateExecutable($migration, new MigrateMessage());
|
||||
$executable->import();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests migration of contact variables to contact.settings.yml.
|
||||
*/
|
||||
public function testContactSettings() {
|
||||
$config = $this->config('contact.settings');
|
||||
$this->assertIdentical(true, $config->get('user_default_enabled'));
|
||||
$this->assertIdentical(3, $config->get('flood.limit'));
|
||||
$this->assertIdentical('some_other_category', $config->get('default_form'));
|
||||
$this->assertConfigSchema(\Drupal::service('config.typed'), 'contact.settings', $config->get());
|
||||
}
|
||||
|
||||
}
|
|
@ -1,67 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Tests\d6\MigrateDateFormatTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\Core\Datetime\DrupalDateTime;
|
||||
use Drupal\migrate\MigrateMessage;
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
use Drupal\Core\Database\Database;
|
||||
|
||||
/**
|
||||
* Upgrade date formats to core.date_format.*.yml.
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class MigrateDateFormatTest extends MigrateDrupal6TestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
/** @var \Drupal\migrate\entity\Migration $migration */
|
||||
$migration = entity_load('migration', 'd6_date_formats');
|
||||
$dumps = array(
|
||||
$this->getDumpDirectory() . '/Variable.php',
|
||||
);
|
||||
$this->prepare($migration, $dumps);
|
||||
$executable = new MigrateExecutable($migration, new MigrateMessage());
|
||||
$executable->import();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the Drupal 6 date formats to Drupal 8 migration.
|
||||
*/
|
||||
public function testDateFormats() {
|
||||
$short_date_format = entity_load('date_format', 'short');
|
||||
$this->assertIdentical('\S\H\O\R\T m/d/Y - H:i', $short_date_format->getPattern());
|
||||
|
||||
$medium_date_format = entity_load('date_format', 'medium');
|
||||
$this->assertIdentical('\M\E\D\I\U\M D, m/d/Y - H:i', $medium_date_format->getPattern());
|
||||
|
||||
$long_date_format = entity_load('date_format', 'long');
|
||||
$this->assertIdentical('\L\O\N\G l, F j, Y - H:i', $long_date_format->getPattern());
|
||||
|
||||
// Test that we can re-import using the EntityDateFormat destination.
|
||||
Database::getConnection('default', 'migrate')
|
||||
->update('variable')
|
||||
->fields(array('value' => serialize('\S\H\O\R\T d/m/Y - H:i')))
|
||||
->condition('name', 'date_format_short')
|
||||
->execute();
|
||||
db_truncate(entity_load('migration', 'd6_date_formats')->getIdMap()->mapTableName())->execute();
|
||||
$migration = entity_load_unchanged('migration', 'd6_date_formats');
|
||||
$executable = new MigrateExecutable($migration, $this);
|
||||
$executable->import();
|
||||
|
||||
$short_date_format = entity_load('date_format', 'short');
|
||||
$this->assertIdentical('\S\H\O\R\T d/m/Y - H:i', $short_date_format->getPattern());
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Tests\d6\MigrateDblogConfigsTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\config\Tests\SchemaCheckTestTrait;
|
||||
use Drupal\migrate\MigrateMessage;
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Upgrade variables to dblog.settings.yml.
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class MigrateDblogConfigsTest extends MigrateDrupal6TestBase {
|
||||
|
||||
use SchemaCheckTestTrait;
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('dblog');
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$migration = entity_load('migration', 'd6_dblog_settings');
|
||||
$dumps = array(
|
||||
$this->getDumpDirectory() . '/Variable.php',
|
||||
);
|
||||
$this->prepare($migration, $dumps);
|
||||
$executable = new MigrateExecutable($migration, new MigrateMessage());
|
||||
$executable->import();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests migration of dblog variables to dblog.settings.yml.
|
||||
*/
|
||||
public function testBookSettings() {
|
||||
$config = $this->config('dblog.settings');
|
||||
$this->assertIdentical(1000, $config->get('row_limit'));
|
||||
$this->assertConfigSchema(\Drupal::service('config.typed'), 'dblog.settings', $config->get());
|
||||
}
|
||||
|
||||
}
|
|
@ -17,6 +17,12 @@ use Drupal\user\Entity\User;
|
|||
*/
|
||||
class MigrateDrupal6Test extends MigrateFullDrupalTestBase {
|
||||
|
||||
const BASE_TEST_CLASS = 'Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase';
|
||||
|
||||
protected static $blacklist = array(
|
||||
'Drupal\migrate_drupal\Tests\dependencies\MigrateDependenciesTest',
|
||||
);
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
|
@ -43,6 +49,7 @@ class MigrateDrupal6Test extends MigrateFullDrupalTestBase {
|
|||
'locale',
|
||||
'menu_link_content',
|
||||
'menu_ui',
|
||||
'migrate_drupal',
|
||||
'node',
|
||||
'options',
|
||||
'search',
|
||||
|
@ -114,7 +121,6 @@ class MigrateDrupal6Test extends MigrateFullDrupalTestBase {
|
|||
'd6_syslog_settings',
|
||||
'd6_system_cron',
|
||||
'd6_system_file',
|
||||
'd6_system_filter',
|
||||
'd6_system_image',
|
||||
'd6_system_image_gd',
|
||||
'd6_system_logging',
|
||||
|
@ -198,150 +204,54 @@ class MigrateDrupal6Test extends MigrateFullDrupalTestBase {
|
|||
'name' => $this->randomMachineName(),
|
||||
'status' => 1,
|
||||
])->enforceIsNew(TRUE)->save();
|
||||
|
||||
$this->installMigrations('Drupal 6');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getDumps() {
|
||||
$tests_path = $this->getDumpDirectory();
|
||||
$dumps = array(
|
||||
$tests_path . '/AggregatorFeed.php',
|
||||
$tests_path . '/AggregatorItem.php',
|
||||
$tests_path . '/Blocks.php',
|
||||
$tests_path . '/BlocksRoles.php',
|
||||
$tests_path . '/Book.php',
|
||||
$tests_path . '/Boxes.php',
|
||||
$tests_path . '/Comments.php',
|
||||
$tests_path . '/Contact.php',
|
||||
$tests_path . '/ContentFieldMultivalue.php',
|
||||
$tests_path . '/ContentFieldTest.php',
|
||||
$tests_path . '/ContentFieldTestTwo.php',
|
||||
$tests_path . '/ContentNodeField.php',
|
||||
$tests_path . '/ContentNodeFieldInstance.php',
|
||||
$tests_path . '/ContentTypeStory.php',
|
||||
$tests_path . '/ContentTypeTestPlanet.php',
|
||||
$tests_path . '/EventTimezones.php',
|
||||
$tests_path . '/Files.php',
|
||||
$tests_path . '/FilterFormats.php',
|
||||
$tests_path . '/Filters.php',
|
||||
$tests_path . '/MenuCustom.php',
|
||||
$tests_path . '/MenuLinks.php',
|
||||
$tests_path . '/Node.php',
|
||||
$tests_path . '/NodeRevisions.php',
|
||||
$tests_path . '/NodeType.php',
|
||||
$tests_path . '/Permission.php',
|
||||
$tests_path . '/ProfileFields.php',
|
||||
$tests_path . '/ProfileValues.php',
|
||||
$tests_path . '/Role.php',
|
||||
$tests_path . '/TermData.php',
|
||||
$tests_path . '/TermHierarchy.php',
|
||||
$tests_path . '/TermNode.php',
|
||||
$tests_path . '/Upload.php',
|
||||
$tests_path . '/UrlAlias.php',
|
||||
$tests_path . '/Users.php',
|
||||
$tests_path . '/UsersRoles.php',
|
||||
$tests_path . '/Variable.php',
|
||||
$tests_path . '/Vocabulary.php',
|
||||
$tests_path . '/VocabularyNodeTypes.php',
|
||||
return array(
|
||||
'AggregatorFeed.php',
|
||||
'AggregatorItem.php',
|
||||
'Blocks.php',
|
||||
'BlocksRoles.php',
|
||||
'Book.php',
|
||||
'Boxes.php',
|
||||
'Comments.php',
|
||||
'Contact.php',
|
||||
'ContentFieldMultivalue.php',
|
||||
'ContentFieldTest.php',
|
||||
'ContentFieldTestTwo.php',
|
||||
'ContentNodeField.php',
|
||||
'ContentNodeFieldInstance.php',
|
||||
'ContentTypeStory.php',
|
||||
'ContentTypeTestPlanet.php',
|
||||
'EventTimezones.php',
|
||||
'Files.php',
|
||||
'FilterFormats.php',
|
||||
'Filters.php',
|
||||
'MenuCustom.php',
|
||||
'MenuLinks.php',
|
||||
'Node.php',
|
||||
'NodeRevisions.php',
|
||||
'NodeType.php',
|
||||
'Permission.php',
|
||||
'ProfileFields.php',
|
||||
'ProfileValues.php',
|
||||
'Role.php',
|
||||
'TermData.php',
|
||||
'TermHierarchy.php',
|
||||
'TermNode.php',
|
||||
'Upload.php',
|
||||
'UrlAlias.php',
|
||||
'Users.php',
|
||||
'UsersRoles.php',
|
||||
'Variable.php',
|
||||
'Vocabulary.php',
|
||||
'VocabularyNodeTypes.php',
|
||||
);
|
||||
|
||||
return $dumps;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getTestClassesList() {
|
||||
$classes = array(
|
||||
__NAMESPACE__ . '\MigrateActionConfigsTest',
|
||||
__NAMESPACE__ . '\MigrateAggregatorConfigsTest',
|
||||
__NAMESPACE__ . '\MigrateAggregatorFeedTest',
|
||||
__NAMESPACE__ . '\MigrateAggregatorItemTest',
|
||||
__NAMESPACE__ . '\MigrateBlockTest',
|
||||
__NAMESPACE__ . '\MigrateBookTest',
|
||||
__NAMESPACE__ . '\MigrateBookConfigsTest',
|
||||
__NAMESPACE__ . '\MigrateCckFieldValuesTest',
|
||||
__NAMESPACE__ . '\MigrateCckFieldRevisionTest',
|
||||
__NAMESPACE__ . '\MigrateCommentTypeTest',
|
||||
__NAMESPACE__ . '\MigrateCommentTest',
|
||||
__NAMESPACE__ . '\MigrateCommentVariableEntityDisplayTest',
|
||||
__NAMESPACE__ . '\MigrateCommentVariableEntityFormDisplayTest',
|
||||
__NAMESPACE__ . '\MigrateCommentVariableEntityFormDisplaySubjectTest',
|
||||
__NAMESPACE__ . '\MigrateCommentVariableFieldTest',
|
||||
__NAMESPACE__ . '\MigrateCommentVariableInstanceTest',
|
||||
__NAMESPACE__ . '\MigrateContactCategoryTest',
|
||||
__NAMESPACE__ . '\MigrateContactConfigsTest',
|
||||
__NAMESPACE__ . '\MigrateBlockContentTest',
|
||||
__NAMESPACE__ . '\MigrateDateFormatTest',
|
||||
__NAMESPACE__ . '\MigrateDblogConfigsTest',
|
||||
__NAMESPACE__ . '\MigrateFieldTest',
|
||||
__NAMESPACE__ . '\MigrateFieldInstanceTest',
|
||||
__NAMESPACE__ . '\MigrateFieldFormatterSettingsTest',
|
||||
__NAMESPACE__ . '\MigrateFieldWidgetSettingsTest',
|
||||
__NAMESPACE__ . '\MigrateFileConfigsTest',
|
||||
__NAMESPACE__ . '\MigrateFileTest',
|
||||
__NAMESPACE__ . '\MigrateFilterFormatTest',
|
||||
__NAMESPACE__ . '\MigrateForumConfigsTest',
|
||||
__NAMESPACE__ . '\MigrateLocaleConfigsTest',
|
||||
__NAMESPACE__ . '\MigrateMenuConfigsTest',
|
||||
__NAMESPACE__ . '\MigrateMenuLinkTest',
|
||||
__NAMESPACE__ . '\MigrateMenuTest',
|
||||
__NAMESPACE__ . '\MigrateNodeBundleSettingsTest',
|
||||
__NAMESPACE__ . '\MigrateNodeConfigsTest',
|
||||
__NAMESPACE__ . '\MigrateNodeRevisionTest',
|
||||
__NAMESPACE__ . '\MigrateNodeTest',
|
||||
__NAMESPACE__ . '\MigrateNodeTypeTest',
|
||||
__NAMESPACE__ . '\MigrateUserProfileValuesTest',
|
||||
__NAMESPACE__ . '\MigrateSearchConfigsTest',
|
||||
__NAMESPACE__ . '\MigrateSearchPageTest',
|
||||
__NAMESPACE__ . '\MigrateSimpletestConfigsTest',
|
||||
__NAMESPACE__ . '\MigrateStatisticsConfigsTest',
|
||||
__NAMESPACE__ . '\MigrateSyslogConfigsTest',
|
||||
__NAMESPACE__ . '\MigrateSystemCronTest',
|
||||
__NAMESPACE__ . '\MigrateSystemFileTest',
|
||||
__NAMESPACE__ . '\MigrateSystemFilterTest',
|
||||
__NAMESPACE__ . '\MigrateSystemImageGdTest',
|
||||
__NAMESPACE__ . '\MigrateSystemImageTest',
|
||||
__NAMESPACE__ . '\MigrateSystemLoggingTest',
|
||||
__NAMESPACE__ . '\MigrateSystemMaintenanceTest',
|
||||
__NAMESPACE__ . '\MigrateSystemPerformanceTest',
|
||||
__NAMESPACE__ . '\MigrateSystemRssTest',
|
||||
__NAMESPACE__ . '\MigrateSystemSiteTest',
|
||||
__NAMESPACE__ . '\MigrateTaxonomyConfigsTest',
|
||||
__NAMESPACE__ . '\MigrateTaxonomyTermTest',
|
||||
__NAMESPACE__ . '\MigrateTaxonomyVocabularyTest',
|
||||
__NAMESPACE__ . '\MigrateTermNodeRevisionTest',
|
||||
__NAMESPACE__ . '\MigrateTermNodeTest',
|
||||
__NAMESPACE__ . '\MigrateTextConfigsTest',
|
||||
__NAMESPACE__ . '\MigrateUpdateConfigsTest',
|
||||
__NAMESPACE__ . '\MigrateUploadEntityDisplayTest',
|
||||
__NAMESPACE__ . '\MigrateUploadEntityFormDisplayTest',
|
||||
__NAMESPACE__ . '\MigrateUploadFieldTest',
|
||||
__NAMESPACE__ . '\MigrateUploadInstanceTest',
|
||||
__NAMESPACE__ . '\MigrateUploadTest',
|
||||
__NAMESPACE__ . '\MigrateUrlAliasTest',
|
||||
__NAMESPACE__ . '\MigrateUserConfigsTest',
|
||||
__NAMESPACE__ . '\MigrateUserContactSettingsTest',
|
||||
__NAMESPACE__ . '\MigrateUserProfileEntityDisplayTest',
|
||||
__NAMESPACE__ . '\MigrateUserProfileEntityFormDisplayTest',
|
||||
__NAMESPACE__ . '\MigrateUserProfileFieldTest',
|
||||
__NAMESPACE__ . '\MigrateUserProfileFieldInstanceTest',
|
||||
__NAMESPACE__ . '\MigrateUserPictureEntityDisplayTest',
|
||||
__NAMESPACE__ . '\MigrateUserPictureEntityFormDisplayTest',
|
||||
__NAMESPACE__ . '\MigrateUserPictureFileTest',
|
||||
__NAMESPACE__ . '\MigrateUserPictureFieldTest',
|
||||
__NAMESPACE__ . '\MigrateUserPictureInstanceTest',
|
||||
__NAMESPACE__ . '\MigrateUserRoleTest',
|
||||
__NAMESPACE__ . '\MigrateUserTest',
|
||||
__NAMESPACE__ . '\MigrateViewModesTest',
|
||||
__NAMESPACE__ . '\MigrateVocabularyEntityDisplayTest',
|
||||
__NAMESPACE__ . '\MigrateVocabularyEntityFormDisplayTest',
|
||||
__NAMESPACE__ . '\MigrateVocabularyFieldInstanceTest',
|
||||
__NAMESPACE__ . '\MigrateVocabularyFieldTest',
|
||||
);
|
||||
|
||||
return $classes;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -14,6 +14,14 @@ use Drupal\migrate_drupal\Tests\MigrateDrupalTestBase;
|
|||
*/
|
||||
abstract class MigrateDrupal6TestBase extends MigrateDrupalTestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->installMigrations('Drupal 6');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\Core\Entity\Entity\EntityViewMode;
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Upgrade field formatter settings to entity.display.*.*.yml.
|
||||
|
@ -66,17 +64,14 @@ class MigrateFieldFormatterSettingsTest extends MigrateDrupal6TestBase {
|
|||
);
|
||||
$this->prepareMigrations($id_mappings);
|
||||
|
||||
$migration = entity_load('migration', 'd6_field_formatter_settings');
|
||||
$dumps = array(
|
||||
$this->getDumpDirectory() . '/ContentNodeFieldInstance.php',
|
||||
$this->getDumpDirectory() . '/ContentNodeField.php',
|
||||
$this->getDumpDirectory() . '/ContentFieldTest.php',
|
||||
$this->getDumpDirectory() . '/ContentFieldTestTwo.php',
|
||||
$this->getDumpDirectory() . '/ContentFieldMultivalue.php',
|
||||
);
|
||||
$this->prepare($migration, $dumps);
|
||||
$executable = new MigrateExecutable($migration, $this);
|
||||
$executable->import();
|
||||
$this->loadDumps([
|
||||
'ContentNodeFieldInstance.php',
|
||||
'ContentNodeField.php',
|
||||
'ContentFieldTest.php',
|
||||
'ContentFieldTestTwo.php',
|
||||
'ContentFieldMultivalue.php',
|
||||
]);
|
||||
$this->executeMigration('d6_field_formatter_settings');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\field\Entity\FieldConfig;
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
use Drupal\link\LinkItemInterface;
|
||||
|
||||
/**
|
||||
|
@ -67,20 +65,15 @@ class MigrateFieldInstanceTest extends MigrateDrupal6TestBase {
|
|||
entity_create('node_type', array('type' => 'story'))->save();
|
||||
entity_create('node_type', array('type' => 'test_page'))->save();
|
||||
|
||||
$migration = entity_load('migration', 'd6_field_instance');
|
||||
$dumps = array(
|
||||
$this->getDumpDirectory() . '/ContentNodeFieldInstance.php',
|
||||
$this->getDumpDirectory() . '/ContentNodeField.php',
|
||||
$this->getDumpDirectory() . '/ContentFieldTest.php',
|
||||
$this->getDumpDirectory() . '/ContentFieldTestTwo.php',
|
||||
$this->getDumpDirectory() . '/ContentFieldMultivalue.php',
|
||||
);
|
||||
$this->loadDumps([
|
||||
'ContentNodeFieldInstance.php',
|
||||
'ContentNodeField.php',
|
||||
'ContentFieldTest.php',
|
||||
'ContentFieldTestTwo.php',
|
||||
'ContentFieldMultivalue.php',
|
||||
]);
|
||||
$this->createFields();
|
||||
|
||||
$this->prepare($migration, $dumps);
|
||||
$executable = new MigrateExecutable($migration, $this);
|
||||
$executable->import();
|
||||
|
||||
$this->executeMigration('d6_field_instance');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\field\Entity\FieldStorageConfig;
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Migrate fields.
|
||||
|
@ -30,18 +28,14 @@ class MigrateFieldTest extends MigrateDrupal6TestBase {
|
|||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
/** @var \Drupal\migrate\entity\Migration $migration */
|
||||
$migration = entity_load('migration', 'd6_field');
|
||||
$dumps = array(
|
||||
$this->getDumpDirectory() . '/ContentNodeFieldInstance.php',
|
||||
$this->getDumpDirectory() . '/ContentNodeField.php',
|
||||
$this->getDumpDirectory() . '/ContentFieldTest.php',
|
||||
$this->getDumpDirectory() . '/ContentFieldTestTwo.php',
|
||||
$this->getDumpDirectory() . '/ContentFieldMultivalue.php',
|
||||
);
|
||||
$this->prepare($migration, $dumps);
|
||||
$executable = new MigrateExecutable($migration, $this);
|
||||
$executable->import();
|
||||
$this->loadDumps([
|
||||
'ContentNodeFieldInstance.php',
|
||||
'ContentNodeField.php',
|
||||
'ContentFieldTest.php',
|
||||
'ContentFieldTestTwo.php',
|
||||
'ContentFieldMultivalue.php',
|
||||
]);
|
||||
$this->executeMigration('d6_field');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -7,9 +7,6 @@
|
|||
|
||||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Migrate field widget settings.
|
||||
*
|
||||
|
@ -62,18 +59,14 @@ class MigrateFieldWidgetSettingsTest extends MigrateDrupal6TestBase {
|
|||
),
|
||||
);
|
||||
$this->prepareMigrations($id_mappings);
|
||||
$migration = entity_load('migration', 'd6_field_instance_widget_settings');
|
||||
$dumps = array(
|
||||
$this->getDumpDirectory() . '/ContentNodeFieldInstance.php',
|
||||
$this->getDumpDirectory() . '/ContentNodeField.php',
|
||||
$this->getDumpDirectory() . '/ContentFieldTest.php',
|
||||
$this->getDumpDirectory() . '/ContentFieldTestTwo.php',
|
||||
$this->getDumpDirectory() . '/ContentFieldMultivalue.php',
|
||||
);
|
||||
$this->prepare($migration, $dumps);
|
||||
$executable = new MigrateExecutable($migration, $this);
|
||||
$executable->import();
|
||||
|
||||
$this->loadDumps([
|
||||
'ContentNodeFieldInstance.php',
|
||||
'ContentNodeField.php',
|
||||
'ContentFieldTest.php',
|
||||
'ContentFieldTestTwo.php',
|
||||
'ContentFieldMultivalue.php',
|
||||
]);
|
||||
$this->executeMigration('d6_field_instance_widget_settings');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,9 +8,6 @@
|
|||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\config\Tests\SchemaCheckTestTrait;
|
||||
use Drupal\migrate\MigrateMessage;
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Upgrade variables to file.settings.yml.
|
||||
|
@ -33,13 +30,8 @@ class MigrateFileConfigsTest extends MigrateDrupal6TestBase {
|
|||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$migration = entity_load('migration', 'd6_file_settings');
|
||||
$dumps = array(
|
||||
$this->getDumpDirectory() . '/Variable.php',
|
||||
);
|
||||
$this->prepare($migration, $dumps);
|
||||
$executable = new MigrateExecutable($migration, new MigrateMessage());
|
||||
$executable->import();
|
||||
$this->loadDumps(['Variable.php']);
|
||||
$this->executeMigration('d6_file_settings');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\Component\Utility\Random;
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\migrate\Tests\MigrateDumpAlterInterface;
|
||||
use Drupal\Core\Database\Database;
|
||||
use Drupal\simpletest\TestBase;
|
||||
use Drupal\file\Entity\File;
|
||||
|
||||
/**
|
||||
* file migration.
|
||||
|
@ -43,17 +43,13 @@ class MigrateFileTest extends MigrateDrupal6TestBase implements MigrateDumpAlter
|
|||
$this->installEntitySchema('file');
|
||||
$this->installConfig(['file']);
|
||||
|
||||
$dumps = array(
|
||||
$this->getDumpDirectory() . '/Files.php',
|
||||
);
|
||||
$this->loadDumps(['Files.php']);
|
||||
/** @var \Drupal\migrate\Entity\MigrationInterface $migration */
|
||||
$migration = entity_load('migration', 'd6_file');
|
||||
$source = $migration->get('source');
|
||||
$source['site_path'] = 'core/modules/simpletest';
|
||||
$migration->set('source', $source);
|
||||
$this->prepare($migration, $dumps);
|
||||
$executable = new MigrateExecutable($migration, $this);
|
||||
$executable->import();
|
||||
$this->executeMigration($migration);
|
||||
$this->standalone = TRUE;
|
||||
}
|
||||
|
||||
|
@ -62,7 +58,7 @@ class MigrateFileTest extends MigrateDrupal6TestBase implements MigrateDumpAlter
|
|||
*/
|
||||
public function testFiles() {
|
||||
/** @var \Drupal\file\FileInterface $file */
|
||||
$file = entity_load('file', 1);
|
||||
$file = File::load(1);
|
||||
$this->assertIdentical('Image1.png', $file->getFilename());
|
||||
$this->assertIdentical('39325', $file->getSize());
|
||||
$this->assertIdentical('public://image-1.png', $file->getFileUri());
|
||||
|
@ -76,11 +72,8 @@ class MigrateFileTest extends MigrateDrupal6TestBase implements MigrateDumpAlter
|
|||
|
||||
// Test that we can re-import and also test with file_directory_path set.
|
||||
db_truncate(entity_load('migration', 'd6_file')->getIdMap()->mapTableName())->execute();
|
||||
$migration = entity_load_unchanged('migration', 'd6_file');
|
||||
$dumps = array(
|
||||
$this->getDumpDirectory() . '/Variable.php',
|
||||
);
|
||||
$this->prepare($migration, $dumps);
|
||||
|
||||
$this->loadDumps(['Variable.php']);
|
||||
|
||||
// Update the file_directory_path.
|
||||
Database::getConnection('default', 'migrate')
|
||||
|
@ -93,14 +86,15 @@ class MigrateFileTest extends MigrateDrupal6TestBase implements MigrateDumpAlter
|
|||
->fields(array('value' => serialize($this->getTempFilesDirectory())))
|
||||
->condition('name', 'file_directory_temp')
|
||||
->execute();
|
||||
$executable = new MigrateExecutable($migration, $this);
|
||||
$executable->import();
|
||||
|
||||
$file = entity_load('file', 2);
|
||||
$migration = entity_load_unchanged('migration', 'd6_file');
|
||||
$this->executeMigration($migration);
|
||||
|
||||
$file = File::load(2);
|
||||
$this->assertIdentical('public://core/modules/simpletest/files/image-2.jpg', $file->getFileUri());
|
||||
|
||||
// Ensure that a temporary file has been migrated.
|
||||
$file = entity_load('file', 6);
|
||||
$file = File::load(6);
|
||||
$this->assertIdentical('temporary://' . static::getUniqueFilename(), $file->getFileUri());
|
||||
}
|
||||
|
||||
|
|
|
@ -1,66 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Tests\d6\MigrateFilterFormatTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Upgrade variables to filter.formats.*.yml.
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class MigrateFilterFormatTest extends MigrateDrupal6TestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
static $modules = array('filter');
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$migration = entity_load('migration', 'd6_filter_format');
|
||||
$dumps = array(
|
||||
$this->getDumpDirectory() . '/Filters.php',
|
||||
$this->getDumpDirectory() . '/FilterFormats.php',
|
||||
$this->getDumpDirectory() . '/Variable.php',
|
||||
);
|
||||
$this->prepare($migration, $dumps);
|
||||
$executable = new MigrateExecutable($migration, $this);
|
||||
$executable->import();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the Drupal 6 filter format to Drupal 8 migration.
|
||||
*/
|
||||
public function testFilterFormat() {
|
||||
$filter_format = entity_load('filter_format', 'filtered_html');
|
||||
|
||||
// Check filter status.
|
||||
$filters = $filter_format->get('filters');
|
||||
$this->assertTrue($filters['filter_autop']['status']);
|
||||
$this->assertTrue($filters['filter_url']['status']);
|
||||
$this->assertTrue($filters['filter_htmlcorrector']['status']);
|
||||
$this->assertTrue($filters['filter_html']['status']);
|
||||
|
||||
// These should be false by default.
|
||||
$this->assertFalse(isset($filters['filter_html_escape']));
|
||||
$this->assertFalse(isset($filters['filter_caption']));
|
||||
$this->assertFalse(isset($filters['filter_html_image_secure']));
|
||||
|
||||
// Check variables migrated into filter.
|
||||
$this->assertIdentical('<a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>', $filters['filter_html']['settings']['allowed_html']);
|
||||
$this->assertIdentical(TRUE, $filters['filter_html']['settings']['filter_html_help']);
|
||||
$this->assertIdentical(FALSE, $filters['filter_html']['settings']['filter_html_nofollow']);
|
||||
$this->assertIdentical(72, $filters['filter_url']['settings']['filter_url_length']);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,65 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Tests\d6\MigrateForumConfigsTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\config\Tests\SchemaCheckTestTrait;
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Upgrade variables to forum.settings.yml.
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class MigrateForumConfigsTest extends MigrateDrupal6TestBase {
|
||||
|
||||
use SchemaCheckTestTrait;
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('comment', 'forum', 'taxonomy');
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->prepareMigrations(array(
|
||||
'd6_taxonomy_vocabulary' => array(
|
||||
array(array(1), array('vocabulary_1_i_0_')),
|
||||
)
|
||||
));
|
||||
$migration = entity_load('migration', 'd6_forum_settings');
|
||||
$dumps = array(
|
||||
$this->getDumpDirectory() . '/Variable.php',
|
||||
);
|
||||
$this->prepare($migration, $dumps);
|
||||
$executable = new MigrateExecutable($migration, $this);
|
||||
$executable->import();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests migration of forum variables to forum.settings.yml.
|
||||
*/
|
||||
public function testForumSettings() {
|
||||
$config = $this->config('forum.settings');
|
||||
$this->assertIdentical(15, $config->get('topics.hot_threshold'));
|
||||
$this->assertIdentical(25, $config->get('topics.page_limit'));
|
||||
$this->assertIdentical(1, $config->get('topics.order'));
|
||||
$this->assertIdentical('vocabulary_1_i_0_', $config->get('vocabulary'));
|
||||
// This is 'forum_block_num_0' in D6, but block:active:limit' in D8.
|
||||
$this->assertIdentical(5, $config->get('block.active.limit'));
|
||||
// This is 'forum_block_num_1' in D6, but 'block:new:limit' in D8.
|
||||
$this->assertIdentical(5, $config->get('block.new.limit'));
|
||||
$this->assertConfigSchema(\Drupal::service('config.typed'), 'forum.settings', $config->get());
|
||||
}
|
||||
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Tests\d6\MigrateLocaleConfigsTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\config\Tests\SchemaCheckTestTrait;
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Upgrade variables to locale.settings.yml.
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class MigrateLocaleConfigsTest extends MigrateDrupal6TestBase {
|
||||
|
||||
use SchemaCheckTestTrait;
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('locale', 'language');
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$migration = entity_load('migration', 'd6_locale_settings');
|
||||
$dumps = array(
|
||||
$this->getDumpDirectory() . '/Variable.php',
|
||||
);
|
||||
$this->prepare($migration, $dumps);
|
||||
$executable = new MigrateExecutable($migration, $this);
|
||||
$executable->import();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests migration of locale variables to locale.settings.yml.
|
||||
*/
|
||||
public function testLocaleSettings() {
|
||||
$config = $this->config('locale.settings');
|
||||
$this->assertIdentical(TRUE, $config->get('cache_strings'));
|
||||
$this->assertIdentical('languages', $config->get('javascript.directory'));
|
||||
$this->assertConfigSchema(\Drupal::service('config.typed'), 'locale.settings', $config->get());
|
||||
}
|
||||
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Tests\d6\MigrateMenuConfigsTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\config\Tests\SchemaCheckTestTrait;
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Upgrade variables to menu_ui.settings.yml.
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class MigrateMenuConfigsTest extends MigrateDrupal6TestBase {
|
||||
|
||||
use SchemaCheckTestTrait;
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('menu_ui');
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$migration = entity_load('migration', 'd6_menu_settings');
|
||||
$dumps = array(
|
||||
$this->getDumpDirectory() . '/Variable.php',
|
||||
);
|
||||
$this->prepare($migration, $dumps);
|
||||
$executable = new MigrateExecutable($migration, $this);
|
||||
$executable->import();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests migration of variables for the Menu UI module.
|
||||
*/
|
||||
public function testMenuSettings() {
|
||||
$config = $this->config('menu_ui.settings');
|
||||
$this->assertIdentical(FALSE, $config->get('override_parent_selector'));
|
||||
$this->assertConfigSchema(\Drupal::service('config.typed'), 'menu_ui.settings', $config->get());
|
||||
}
|
||||
|
||||
}
|
|
@ -1,87 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Tests\d6\MigrateMenuLinkTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Menu link migration.
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class MigrateMenuLinkTest extends MigrateDrupal6TestBase {
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('link', 'menu_ui', 'menu_link_content');
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$this->installSchema('system', ['router']);
|
||||
$this->installEntitySchema('menu_link_content');
|
||||
|
||||
$menu = entity_create('menu', array('id' => 'secondary-links'));
|
||||
$menu->enforceIsNew(TRUE);
|
||||
$menu->save();
|
||||
|
||||
$this->prepareMigrations(array(
|
||||
'd6_menu' => array(
|
||||
array(array('secondary-links'), array('secondary-links')),
|
||||
),
|
||||
));
|
||||
|
||||
$migration = entity_load('migration', 'd6_menu_links');
|
||||
$dumps = array(
|
||||
$this->getDumpDirectory() . '/MenuLinks.php',
|
||||
);
|
||||
$this->prepare($migration, $dumps);
|
||||
$executable = new MigrateExecutable($migration, $this);
|
||||
$executable->import();
|
||||
}
|
||||
|
||||
public function testMenuLinks() {
|
||||
$menu_link = entity_load('menu_link_content', 138);
|
||||
$this->assertIdentical('Test 1', $menu_link->getTitle());
|
||||
$this->assertIdentical('secondary-links', $menu_link->getMenuName());
|
||||
$this->assertIdentical('Test menu link 1', $menu_link->getDescription());
|
||||
$this->assertIdentical(TRUE, $menu_link->isEnabled());
|
||||
$this->assertIdentical(FALSE, $menu_link->isExpanded());
|
||||
$this->assertIdentical(['attributes' => ['title' => 'Test menu link 1']], $menu_link->link->options);
|
||||
$this->assertIdentical('internal:/user/login', $menu_link->link->uri);
|
||||
$this->assertIdentical(15, $menu_link->getWeight());
|
||||
|
||||
$menu_link = entity_load('menu_link_content', 139);
|
||||
$this->assertIdentical('Test 2', $menu_link->getTitle());
|
||||
$this->assertIdentical('secondary-links', $menu_link->getMenuName());
|
||||
$this->assertIdentical('Test menu link 2', $menu_link->getDescription());
|
||||
$this->assertIdentical(TRUE, $menu_link->isEnabled());
|
||||
$this->assertIdentical(TRUE, $menu_link->isExpanded());
|
||||
$this->assertIdentical(['query' => 'foo=bar', 'attributes' => ['title' => 'Test menu link 2']], $menu_link->link->options);
|
||||
$this->assertIdentical('internal:/admin', $menu_link->link->uri);
|
||||
$this->assertIdentical(12, $menu_link->getWeight());
|
||||
|
||||
$menu_link = entity_load('menu_link_content', 140);
|
||||
$this->assertIdentical('Drupal.org', $menu_link->getTitle());
|
||||
$this->assertIdentical('secondary-links', $menu_link->getMenuName());
|
||||
$this->assertIdentical('', $menu_link->getDescription());
|
||||
$this->assertIdentical(TRUE, $menu_link->isEnabled());
|
||||
$this->assertIdentical(FALSE, $menu_link->isExpanded());
|
||||
$this->assertIdentical(['attributes' => ['title' => '']], $menu_link->link->options);
|
||||
$this->assertIdentical('https://www.drupal.org', $menu_link->link->uri);
|
||||
$this->assertIdentical(0, $menu_link->getWeight());
|
||||
}
|
||||
|
||||
}
|
|
@ -1,65 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Tests\d6\MigrateMenuTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\migrate\MigrateMessage;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
use Drupal\Core\Database\Database;
|
||||
use Drupal\system\Entity\Menu;
|
||||
|
||||
/**
|
||||
* Upgrade menus to system.menu.*.yml.
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class MigrateMenuTest extends MigrateDrupal6TestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$migration = entity_load('migration', 'd6_menu');
|
||||
$dumps = array(
|
||||
$this->getDumpDirectory() . '/MenuCustom.php',
|
||||
);
|
||||
$this->prepare($migration, $dumps);
|
||||
$executable = new MigrateExecutable($migration, $this);
|
||||
$executable->import();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the Drupal 6 menu to Drupal 8 migration.
|
||||
*/
|
||||
public function testMenu() {
|
||||
$navigation_menu = Menu::load('navigation');
|
||||
$this->assertIdentical('navigation', $navigation_menu->id());
|
||||
$this->assertIdentical('Navigation', $navigation_menu->label());
|
||||
$expected = <<<EOT
|
||||
The navigation menu is provided by Drupal and is the main interactive menu for any site. It is usually the only menu that contains personalized links for authenticated users, and is often not even visible to anonymous users.
|
||||
EOT;
|
||||
$this->assertIdentical($expected, $navigation_menu->getDescription());
|
||||
|
||||
// Test that we can re-import using the ConfigEntityBase destination.
|
||||
Database::getConnection('default', 'migrate')
|
||||
->update('menu_custom')
|
||||
->fields(array('title' => 'Home Navigation'))
|
||||
->condition('menu_name', 'navigation')
|
||||
->execute();
|
||||
|
||||
db_truncate(entity_load('migration', 'd6_menu')->getIdMap()->mapTableName())->execute();
|
||||
$migration = entity_load_unchanged('migration', 'd6_menu');
|
||||
$executable = new MigrateExecutable($migration, $this);
|
||||
$executable->import();
|
||||
|
||||
$navigation_menu = entity_load_unchanged('menu', 'navigation');
|
||||
$this->assertIdentical('Home Navigation', $navigation_menu->label());
|
||||
}
|
||||
|
||||
}
|
|
@ -1,106 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Tests\d6\MigrateNodeBundleSettingsTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Test migrating node settings into the base_field_bundle_override config entity.
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class MigrateNodeBundleSettingsTest extends MigrateDrupal6TestBase {
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('node');
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
// Setup the bundles.
|
||||
entity_create('node_type', array('type' => 'test_page'))->save();
|
||||
entity_create('node_type', array('type' => 'test_planet'))->save();
|
||||
entity_create('node_type', array('type' => 'test_story'))->save();
|
||||
entity_create('node_type', array('type' => 'test_event'))->save();
|
||||
entity_create('node_type', array('type' => 'story'))->save();
|
||||
entity_create('node_type', array('type' => 'article'))->save();
|
||||
entity_create('node_type', array('type' => 'company'))->save();
|
||||
entity_create('node_type', array('type' => 'employee'))->save();
|
||||
entity_create('node_type', array('type' => 'page'))->save();
|
||||
entity_create('node_type', array('type' => 'sponsor'))->save();
|
||||
entity_create('node_type', array('type' => 'event'))->save();
|
||||
entity_create('node_type', array('type' => 'book'))->save();
|
||||
|
||||
// Create a config entity that already exists.
|
||||
entity_create('base_field_override', array('field_name' => 'promote', 'entity_type' => 'node', 'bundle' => 'page',))->save();
|
||||
|
||||
$id_mappings = array(
|
||||
'd6_node_type' => array(
|
||||
array(array('test_page'), array('test_page')),
|
||||
array(array('test_planet'), array('test_planet')),
|
||||
array(array('test_story'), array('test_story')),
|
||||
array(array('test_event'), array('test_event')),
|
||||
array(array('story'), array('story')),
|
||||
),
|
||||
);
|
||||
$this->prepareMigrations($id_mappings);
|
||||
|
||||
// Setup the dumps.
|
||||
$migration = entity_load('migration', 'd6_node_setting_promote');
|
||||
$dumps = array(
|
||||
$this->getDumpDirectory() . '/NodeType.php',
|
||||
$this->getDumpDirectory() . '/Variable.php',
|
||||
);
|
||||
$this->prepare($migration, $dumps);
|
||||
|
||||
// Run the migrations.
|
||||
$executable = new MigrateExecutable($migration, $this);
|
||||
$executable->import();
|
||||
|
||||
$migration = entity_load('migration', 'd6_node_setting_status');
|
||||
$executable = new MigrateExecutable($migration, $this);
|
||||
$executable->import();
|
||||
|
||||
$migration = entity_load('migration', 'd6_node_setting_sticky');
|
||||
$executable = new MigrateExecutable($migration, $this);
|
||||
$executable->import();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests Drupal 6 node type settings to Drupal 8 migration.
|
||||
*/
|
||||
public function testNodeBundleSettings() {
|
||||
|
||||
// Test settings on test_page bundle.
|
||||
$node = entity_create('node', array('type' => 'test_page'));
|
||||
$this->assertIdentical(1, $node->status->value);
|
||||
$this->assertIdentical(1, $node->promote->value);
|
||||
$this->assertIdentical(1, $node->sticky->value);
|
||||
|
||||
// Test settings for test_story bundle.
|
||||
$node = entity_create('node', array('type' => 'test_story'));
|
||||
$this->assertIdentical(1, $node->status->value);
|
||||
$this->assertIdentical(1, $node->promote->value);
|
||||
$this->assertIdentical(0, $node->sticky->value);
|
||||
|
||||
// Test settings for the test_event bundle.
|
||||
$node = entity_create('node', array('type' => 'test_event'));
|
||||
$this->assertIdentical(0, $node->status->value);
|
||||
$this->assertIdentical(0, $node->promote->value);
|
||||
$this->assertIdentical(1, $node->sticky->value);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Tests\d6\MigrateNodeConfigsTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\config\Tests\SchemaCheckTestTrait;
|
||||
use Drupal\migrate\MigrateMessage;
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Upgrade variables to node.settings.yml.
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class MigrateNodeConfigsTest extends MigrateDrupal6TestBase {
|
||||
|
||||
use SchemaCheckTestTrait;
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('node');
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$migration = entity_load('migration', 'd6_node_settings');
|
||||
$dumps = array(
|
||||
$this->getDumpDirectory() . '/Variable.php',
|
||||
);
|
||||
$this->prepare($migration, $dumps);
|
||||
$executable = new MigrateExecutable($migration, new MigrateMessage);
|
||||
$executable->import();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests Drupal 6 node settings to Drupal 8 migration.
|
||||
*/
|
||||
public function testNodeSettings() {
|
||||
$config = $this->config('node.settings');
|
||||
$this->assertIdentical(FALSE, $config->get('use_admin_theme'));
|
||||
$this->assertConfigSchema(\Drupal::service('config.typed'), 'node.settings', $config->get());
|
||||
}
|
||||
|
||||
}
|
|
@ -1,76 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Tests\d6\MigrateNodeRevisionTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\Core\Database\Database;
|
||||
|
||||
/**
|
||||
* Node content revisions migration.
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class MigrateNodeRevisionTest extends MigrateNodeTestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$id_mappings = array(
|
||||
'd6_node' => array(
|
||||
array(array(1), array(1)),
|
||||
),
|
||||
);
|
||||
$this->prepareMigrations($id_mappings);
|
||||
|
||||
$dumps = array(
|
||||
$this->getDumpDirectory() . '/Users.php',
|
||||
);
|
||||
$this->loadDumps($dumps);
|
||||
|
||||
// Create our users for the node authors.
|
||||
$query = Database::getConnection('default', 'migrate')->query('SELECT * FROM {users} WHERE uid NOT IN (0, 1)');
|
||||
while(($row = $query->fetchAssoc()) !== FALSE) {
|
||||
$user = entity_create('user', $row);
|
||||
$user->enforceIsNew();
|
||||
$user->save();
|
||||
}
|
||||
|
||||
/** @var \Drupal\migrate\entity\Migration $migration */
|
||||
$migration = entity_load('migration', 'd6_node_revision');
|
||||
$executable = new MigrateExecutable($migration, $this);
|
||||
$executable->import();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test node revisions migration from Drupal 6 to 8.
|
||||
*/
|
||||
public function testNodeRevision() {
|
||||
$node = \Drupal::entityManager()->getStorage('node')->loadRevision(2);
|
||||
/** @var \Drupal\node\NodeInterface $node */
|
||||
$this->assertIdentical('1', $node->id());
|
||||
$this->assertIdentical('2', $node->getRevisionId());
|
||||
$this->assertIdentical('und', $node->langcode->value);
|
||||
$this->assertIdentical('Test title rev 2', $node->getTitle());
|
||||
$this->assertIdentical('body test rev 2', $node->body->value);
|
||||
$this->assertIdentical('teaser test rev 2', $node->body->summary);
|
||||
$this->assertIdentical('2', $node->getRevisionAuthor()->id());
|
||||
$this->assertIdentical('modified rev 2', $node->revision_log->value);
|
||||
$this->assertIdentical('1390095702', $node->getRevisionCreationTime());
|
||||
|
||||
$node = \Drupal::entityManager()->getStorage('node')->loadRevision(5);
|
||||
$this->assertIdentical('1', $node->id());
|
||||
$this->assertIdentical('body test rev 3', $node->body->value);
|
||||
$this->assertIdentical('1', $node->getRevisionAuthor()->id());
|
||||
$this->assertIdentical('modified rev 3', $node->revision_log->value);
|
||||
$this->assertIdentical('1390095703', $node->getRevisionCreationTime());
|
||||
}
|
||||
|
||||
}
|
|
@ -1,94 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Tests\d6\MigrateNodeTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\Core\Database\Database;
|
||||
use Drupal\node\Entity\Node;
|
||||
|
||||
/**
|
||||
* Node content migration.
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class MigrateNodeTest extends MigrateNodeTestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
/** @var \Drupal\migrate\entity\Migration $migration */
|
||||
$migration = entity_load('migration', 'd6_node');
|
||||
$executable = new MigrateExecutable($migration, $this);
|
||||
$executable->import();
|
||||
|
||||
// This is required for the second import below.
|
||||
db_truncate($migration->getIdMap()->mapTableName())->execute();
|
||||
$this->standalone = TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test node migration from Drupal 6 to 8.
|
||||
*/
|
||||
public function testNode() {
|
||||
$node = Node::load(1);
|
||||
$this->assertIdentical('1', $node->id(), 'Node 1 loaded.');
|
||||
$this->assertIdentical('und', $node->langcode->value);
|
||||
$this->assertIdentical('test', $node->body->value);
|
||||
$this->assertIdentical('test', $node->body->summary);
|
||||
$this->assertIdentical('filtered_html', $node->body->format);
|
||||
$this->assertIdentical('story', $node->getType(), 'Node has the correct bundle.');
|
||||
$this->assertIdentical('Test title', $node->getTitle(), 'Node has the correct title.');
|
||||
$this->assertIdentical('1388271197', $node->getCreatedTime(), 'Node has the correct created time.');
|
||||
$this->assertIdentical(FALSE, $node->isSticky());
|
||||
$this->assertIdentical('1', $node->getOwnerId());
|
||||
$this->assertIdentical('1420861423', $node->getRevisionCreationTime());
|
||||
|
||||
/** @var \Drupal\node\NodeInterface $node_revision */
|
||||
$node_revision = \Drupal::entityManager()->getStorage('node')->loadRevision(1);
|
||||
$this->assertIdentical('Test title', $node_revision->getTitle());
|
||||
$this->assertIdentical('1', $node_revision->getRevisionAuthor()->id(), 'Node revision has the correct user');
|
||||
// This is empty on the first revision.
|
||||
$this->assertIdentical('', $node_revision->revision_log->value);
|
||||
|
||||
// It is pointless to run the second half from MigrateDrupal6Test.
|
||||
if (empty($this->standalone)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Test that we can re-import using the EntityContentBase destination.
|
||||
$connection = Database::getConnection('default', 'migrate');
|
||||
$connection->update('node_revisions')
|
||||
->fields(array(
|
||||
'title' => 'New node title',
|
||||
'format' => 2,
|
||||
))
|
||||
->condition('vid', 1)
|
||||
->execute();
|
||||
$connection->delete('content_field_test_two')
|
||||
->condition('delta', 1)
|
||||
->execute();
|
||||
|
||||
/** @var \Drupal\migrate\entity\Migration $migration */
|
||||
$migration = entity_load('migration', 'd6_node');
|
||||
$executable = new MigrateExecutable($migration, $this);
|
||||
$executable->import();
|
||||
|
||||
$node = Node::load(1);
|
||||
$this->assertIdentical('New node title', $node->getTitle());
|
||||
// Test a multi-column fields are correctly upgraded.
|
||||
$this->assertIdentical('test', $node->body->value);
|
||||
$this->assertIdentical('full_html', $node->body->format);
|
||||
|
||||
$node = Node::load(3);
|
||||
// Test that format = 0 from source maps to filtered_html.
|
||||
$this->assertIdentical('filtered_html', $node->body->format);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,115 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Tests\d6\MigrateNodeTestBase.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
use Drupal\migrate\Entity\MigrationInterface;
|
||||
use Drupal\user\Entity\User;
|
||||
|
||||
/**
|
||||
* Base class for Node migration tests.
|
||||
*/
|
||||
abstract class MigrateNodeTestBase extends MigrateDrupal6TestBase {
|
||||
|
||||
static $modules = array('node', 'text', 'filter', 'entity_reference');
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$this->installEntitySchema('node');
|
||||
$this->installConfig(['node']);
|
||||
$this->installSchema('node', ['node_access']);
|
||||
$this->installSchema('system', ['sequences']);
|
||||
|
||||
// Create a new user which needs to have UID 1, because that is expected by
|
||||
// the assertions from
|
||||
// \Drupal\migrate_drupal\Tests\d6\MigrateNodeRevisionTest.
|
||||
User::create([
|
||||
'uid' => 1,
|
||||
'name' => $this->randomMachineName(),
|
||||
'status' => 1,
|
||||
])->enforceIsNew(TRUE)->save();
|
||||
|
||||
|
||||
$node_type = entity_create('node_type', array('type' => 'test_planet'));
|
||||
$node_type->save();
|
||||
node_add_body_field($node_type);
|
||||
$node_type = entity_create('node_type', array('type' => 'story'));
|
||||
$node_type->save();
|
||||
node_add_body_field($node_type);
|
||||
|
||||
$id_mappings = array(
|
||||
'd6_node_type' => array(
|
||||
array(array('test_story'), array('story')),
|
||||
),
|
||||
'd6_filter_format' => array(
|
||||
array(array(1), array('filtered_html')),
|
||||
array(array(2), array('full_html')),
|
||||
),
|
||||
'd6_user' => array(
|
||||
array(array(1), array(1)),
|
||||
array(array(2), array(2)),
|
||||
),
|
||||
'd6_field_instance_widget_settings' => array(
|
||||
array(
|
||||
array('page', 'field_test'),
|
||||
array('node', 'page', 'default', 'test'),
|
||||
),
|
||||
),
|
||||
'd6_field_formatter_settings' => array(
|
||||
array(
|
||||
array('page', 'default', 'node', 'field_test'),
|
||||
array('node', 'page', 'default', 'field_test'),
|
||||
),
|
||||
),
|
||||
);
|
||||
$this->prepareMigrations($id_mappings);
|
||||
|
||||
$migration = entity_load('migration', 'd6_node_settings');
|
||||
$migration->setMigrationResult(MigrationInterface::RESULT_COMPLETED);
|
||||
|
||||
// Create a test node.
|
||||
$node = entity_create('node', array(
|
||||
'type' => 'story',
|
||||
'nid' => 1,
|
||||
'vid' => 1,
|
||||
'revision_log' => '',
|
||||
));
|
||||
$node->enforceIsNew();
|
||||
$node->save();
|
||||
|
||||
$node = entity_create('node', array(
|
||||
'type' => 'test_planet',
|
||||
'nid' => 3,
|
||||
'vid' => 4,
|
||||
'revision_log' => '',
|
||||
));
|
||||
$node->enforceIsNew();
|
||||
$node->save();
|
||||
|
||||
// Load dumps.
|
||||
$dumps = array(
|
||||
$this->getDumpDirectory() . '/Node.php',
|
||||
$this->getDumpDirectory() . '/NodeRevisions.php',
|
||||
$this->getDumpDirectory() . '/ContentTypeStory.php',
|
||||
$this->getDumpDirectory() . '/ContentTypeTestPlanet.php',
|
||||
$this->getDumpDirectory() . '/NodeType.php',
|
||||
$this->getDumpDirectory() . '/Variable.php',
|
||||
$this->getDumpDirectory() . '/ContentNodeFieldInstance.php',
|
||||
$this->getDumpDirectory() . '/ContentNodeField.php',
|
||||
$this->getDumpDirectory() . '/ContentFieldTest.php',
|
||||
$this->getDumpDirectory() . '/ContentFieldTestTwo.php',
|
||||
$this->getDumpDirectory() . '/ContentFieldMultivalue.php',
|
||||
);
|
||||
$this->loadDumps($dumps);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,91 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Tests\d6\MigrateNodeTypeTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\field\Entity\FieldConfig;
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
use Drupal\node\Entity\NodeType;
|
||||
|
||||
/**
|
||||
* Upgrade node types to node.type.*.yml.
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class MigrateNodeTypeTest extends MigrateDrupal6TestBase {
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('node', 'text', 'filter');
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$this->installConfig(array('node'));
|
||||
|
||||
$migration = entity_load('migration', 'd6_node_type');
|
||||
$dumps = array(
|
||||
$this->getDumpDirectory() . '/NodeType.php',
|
||||
$this->getDumpDirectory() . '/Variable.php',
|
||||
);
|
||||
$this->prepare($migration, $dumps);
|
||||
$executable = new MigrateExecutable($migration, $this);
|
||||
$executable->import();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests Drupal 6 node type to Drupal 8 migration.
|
||||
*/
|
||||
public function testNodeType() {
|
||||
$migration = entity_load('migration', 'd6_node_type');
|
||||
// Test the test_page content type.
|
||||
$node_type_page = NodeType::load('test_page');
|
||||
$this->assertIdentical('test_page', $node_type_page->id(), 'Node type test_page loaded');
|
||||
$this->assertIdentical(TRUE, $node_type_page->displaySubmitted());
|
||||
$this->assertIdentical(FALSE, $node_type_page->isNewRevision());
|
||||
$this->assertIdentical(DRUPAL_OPTIONAL, $node_type_page->getPreviewMode());
|
||||
$this->assertIdentical($migration->getIdMap()->lookupDestinationID(array('test_page')), array('test_page'));
|
||||
|
||||
// Test we have a body field.
|
||||
$field = FieldConfig::loadByName('node', 'test_page', 'body');
|
||||
$this->assertIdentical('This is the body field label', $field->getLabel(), 'Body field was found.');
|
||||
|
||||
// Test the test_story content type.
|
||||
$node_type_story = NodeType::load('test_story');
|
||||
$this->assertIdentical('test_story', $node_type_story->id(), 'Node type test_story loaded');
|
||||
|
||||
$this->assertIdentical(TRUE, $node_type_story->displaySubmitted());
|
||||
$this->assertIdentical(FALSE, $node_type_story->isNewRevision());
|
||||
$this->assertIdentical(DRUPAL_OPTIONAL, $node_type_story->getPreviewMode());
|
||||
$this->assertIdentical($migration->getIdMap()->lookupDestinationID(array('test_story')), array('test_story'));
|
||||
|
||||
// Test we don't have a body field.
|
||||
$field = FieldConfig::loadByName('node', 'test_story', 'body');
|
||||
$this->assertIdentical(NULL, $field, 'No body field found');
|
||||
|
||||
// Test the test_event content type.
|
||||
$node_type_event = NodeType::load('test_event');
|
||||
$this->assertIdentical('test_event', $node_type_event->id(), 'Node type test_event loaded');
|
||||
|
||||
$this->assertIdentical(TRUE, $node_type_event->displaySubmitted());
|
||||
$this->assertIdentical(TRUE, $node_type_event->isNewRevision());
|
||||
$this->assertIdentical(DRUPAL_OPTIONAL, $node_type_event->getPreviewMode());
|
||||
$this->assertIdentical($migration->getIdMap()->lookupDestinationID(array('test_event')), array('test_event'));
|
||||
|
||||
// Test we have a body field.
|
||||
$field = FieldConfig::loadByName('node', 'test_event', 'body');
|
||||
$this->assertIdentical('Body', $field->getLabel(), 'Body field was found.');
|
||||
}
|
||||
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Tests\d6\MigrateSearchConfigsTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\config\Tests\SchemaCheckTestTrait;
|
||||
use Drupal\migrate\MigrateMessage;
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Upgrade variables to search.settings.yml.
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class MigrateSearchConfigsTest extends MigrateDrupal6TestBase {
|
||||
|
||||
use SchemaCheckTestTrait;
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('search');
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$migration = entity_load('migration', 'd6_search_settings');
|
||||
$dumps = array(
|
||||
$this->getDumpDirectory() . '/Variable.php',
|
||||
);
|
||||
$this->prepare($migration, $dumps);
|
||||
$executable = new MigrateExecutable($migration, new MigrateMessage());
|
||||
$executable->import();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests migration of search variables to search.settings.yml.
|
||||
*/
|
||||
public function testSearchSettings() {
|
||||
$config = $this->config('search.settings');
|
||||
$this->assertIdentical(3, $config->get('index.minimum_word_size'));
|
||||
$this->assertIdentical(TRUE, $config->get('index.overlap_cjk'));
|
||||
$this->assertIdentical(100, $config->get('index.cron_limit'));
|
||||
$this->assertIdentical(TRUE, $config->get('logging'));
|
||||
$this->assertConfigSchema(\Drupal::service('config.typed'), 'search.settings', $config->get());
|
||||
}
|
||||
|
||||
}
|
|
@ -1,76 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Tests\d6\MigrateSearchPageTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
use Drupal\Core\Database\Database;
|
||||
|
||||
/**
|
||||
* Upgrade search rank settings to search.page.*.yml.
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class MigrateSearchPageTest extends MigrateDrupal6TestBase {
|
||||
|
||||
/**
|
||||
* The modules to be enabled during the test.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
static $modules = array('node', 'search');
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
/** @var \Drupal\migrate\entity\Migration $migration */
|
||||
$migration = entity_load('migration', 'd6_search_page');
|
||||
$dumps = array(
|
||||
$this->getDumpDirectory() . '/Variable.php',
|
||||
);
|
||||
$this->prepare($migration, $dumps);
|
||||
$executable = new MigrateExecutable($migration, $this);
|
||||
$executable->import();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests Drupal 6 search settings to Drupal 8 search page entity migration.
|
||||
*/
|
||||
public function testSearchPage() {
|
||||
$id = 'node_search';
|
||||
/** @var \Drupal\search\Entity\SearchPage $search_page */
|
||||
$search_page = entity_load('search_page', $id);
|
||||
$this->assertIdentical($id, $search_page->id());
|
||||
$configuration = $search_page->getPlugin()->getConfiguration();
|
||||
$this->assertIdentical($configuration['rankings'], array(
|
||||
'comments' => 5,
|
||||
'relevance' => 2,
|
||||
'sticky' => 8,
|
||||
'views' => 1,
|
||||
));
|
||||
$this->assertIdentical('node', $search_page->getPath());
|
||||
|
||||
// Test that we can re-import using the EntitySearchPage destination.
|
||||
Database::getConnection('default', 'migrate')
|
||||
->update('variable')
|
||||
->fields(array('value' => serialize(4)))
|
||||
->condition('name', 'node_rank_comments')
|
||||
->execute();
|
||||
|
||||
$migration = entity_load_unchanged('migration', 'd6_search_page');
|
||||
$executable = new MigrateExecutable($migration, $this);
|
||||
$executable->import();
|
||||
|
||||
$search_page = entity_load('search_page', $id);
|
||||
$configuration = $search_page->getPlugin()->getConfiguration();
|
||||
$this->assertIdentical(4, $configuration['rankings']['comments']);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,63 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Tests\d6\MigrateSimpletestConfigsTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\config\Tests\SchemaCheckTestTrait;
|
||||
use Drupal\migrate\MigrateMessage;
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Upgrade variables to simpletest.settings.yml.
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class MigrateSimpletestConfigsTest extends MigrateDrupal6TestBase {
|
||||
|
||||
use SchemaCheckTestTrait;
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('simpletest');
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$this->installConfig(['simpletest']);
|
||||
|
||||
$migration = entity_load('migration', 'd6_simpletest_settings');
|
||||
$dumps = array(
|
||||
$this->getDumpDirectory() . '/Variable.php',
|
||||
);
|
||||
$this->prepare($migration, $dumps);
|
||||
$executable = new MigrateExecutable($migration, new MigrateMessage());
|
||||
$executable->import();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests migration of simpletest variables to simpletest.settings.yml.
|
||||
*/
|
||||
public function testSimpletestSettings() {
|
||||
$config = $this->config('simpletest.settings');
|
||||
$this->assertIdentical(TRUE, $config->get('clear_results'));
|
||||
$this->assertIdentical(CURLAUTH_BASIC, $config->get('httpauth.method'));
|
||||
// NULL in the dump means defaults which is empty string. Same as omitting
|
||||
// them.
|
||||
$this->assertIdentical('', $config->get('httpauth.password'));
|
||||
$this->assertIdentical('', $config->get('httpauth.username'));
|
||||
$this->assertIdentical(TRUE, $config->get('verbose'));
|
||||
$this->assertConfigSchema(\Drupal::service('config.typed'), 'simpletest.settings', $config->get());
|
||||
}
|
||||
|
||||
}
|
|
@ -1,56 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Tests\d6\MigrateStatisticsConfigsTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\config\Tests\SchemaCheckTestTrait;
|
||||
use Drupal\migrate\MigrateMessage;
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Upgrade variables to statistics.settings.yml.
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class MigrateStatisticsConfigsTest extends MigrateDrupal6TestBase {
|
||||
|
||||
use SchemaCheckTestTrait;
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('statistics');
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$migration = entity_load('migration', 'd6_statistics_settings');
|
||||
$dumps = array(
|
||||
$this->getDumpDirectory() . '/Variable.php',
|
||||
);
|
||||
$this->prepare($migration, $dumps);
|
||||
$executable = new MigrateExecutable($migration, new MigrateMessage());
|
||||
$executable->import();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests migration of statistics variables to statistics.settings.yml.
|
||||
*/
|
||||
public function testStatisticsSettings() {
|
||||
$config = $this->config('statistics.settings');
|
||||
$this->assertIdentical(FALSE, $config->get('access_log.enabled'));
|
||||
$this->assertIdentical(259200, $config->get('access_log.max_lifetime'));
|
||||
$this->assertIdentical(0, $config->get('count_content_views'));
|
||||
$this->assertConfigSchema(\Drupal::service('config.typed'), 'statistics.settings', $config->get());
|
||||
}
|
||||
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Tests\d6\MigrateSyslogConfigsTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\config\Tests\SchemaCheckTestTrait;
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Upgrade variables to syslog.settings.yml.
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class MigrateSyslogConfigsTest extends MigrateDrupal6TestBase {
|
||||
|
||||
use SchemaCheckTestTrait;
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('syslog');
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$migration = entity_load('migration', 'd6_syslog_settings');
|
||||
$dumps = array(
|
||||
$this->getDumpDirectory() . '/Variable.php',
|
||||
);
|
||||
$this->prepare($migration, $dumps);
|
||||
$executable = new MigrateExecutable($migration, $this);
|
||||
$executable->import();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests migration of syslog variables to syslog.settings.yml.
|
||||
*/
|
||||
public function testSyslogSettings() {
|
||||
$config = $this->config('syslog.settings');
|
||||
$this->assertIdentical('drupal', $config->get('identity'));
|
||||
$this->assertIdentical('128', $config->get('facility'));
|
||||
$this->assertConfigSchema(\Drupal::service('config.typed'), 'syslog.settings', $config->get());
|
||||
}
|
||||
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Tests\d6\MigrateSystemCronTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\migrate\MigrateMessage;
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Upgrade cron variable to system.*.yml.
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class MigrateSystemCronTest extends MigrateDrupal6TestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$migration = entity_load('migration', 'd6_system_cron');
|
||||
$dumps = array(
|
||||
$this->getDumpDirectory() . '/Variable.php',
|
||||
);
|
||||
$this->prepare($migration, $dumps);
|
||||
$executable = new MigrateExecutable($migration, new MigrateMessage());
|
||||
$executable->import();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests migration of system (cron) variables to system.cron.yml.
|
||||
*/
|
||||
public function testSystemCron() {
|
||||
$config = $this->config('system.cron');
|
||||
$this->assertIdentical(172800, $config->get('threshold.requirements_warning'));
|
||||
$this->assertIdentical(1209600, $config->get('threshold.requirements_error'));
|
||||
}
|
||||
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Tests\d6\MigrateSystemFileTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\migrate\MigrateMessage;
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Upgrade variables to system.*.yml.
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class MigrateSystemFileTest extends MigrateDrupal6TestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$migration = entity_load('migration', 'd6_system_file');
|
||||
$dumps = array(
|
||||
$this->getDumpDirectory() . '/Variable.php',
|
||||
);
|
||||
$this->prepare($migration, $dumps);
|
||||
$executable = new MigrateExecutable($migration, new MigrateMessage());
|
||||
$executable->import();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests migration of system (file) variables to system.file.yml.
|
||||
*/
|
||||
public function testSystemFile() {
|
||||
$config = \Drupal::configFactory()->getEditable('system.file');
|
||||
$this->assertIdentical('files/temp', $config->get('path.temporary'));
|
||||
$this->assertIdentical(TRUE, $config->get('allow_insecure_uploads'));
|
||||
}
|
||||
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Tests\d6\MigrateSystemFilterTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\migrate\MigrateMessage;
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Upgrade filter variables to system.*.yml.
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class MigrateSystemFilterTest extends MigrateDrupal6TestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$migration = entity_load('migration', 'd6_system_filter');
|
||||
$dumps = array(
|
||||
$this->getDumpDirectory() . '/Variable.php',
|
||||
);
|
||||
$this->prepare($migration, $dumps);
|
||||
$executable = new MigrateExecutable($migration, new MigrateMessage());
|
||||
$executable->import();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests migration of system (filter) variables to system.filter.yml.
|
||||
*/
|
||||
public function testSystemFilter() {
|
||||
$config = $this->config('system.filter');
|
||||
$this->assertIdentical(array('http', 'https', 'ftp', 'news', 'nntp', 'tel', 'telnet', 'mailto', 'irc', 'ssh', 'sftp', 'webcal', 'rtsp'), $config->get('protocols'));
|
||||
}
|
||||
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Tests\d6\MigrateSystemImageGdTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\migrate\MigrateMessage;
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Upgrade image gd variables to system.*.yml.
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class MigrateSystemImageGdTest extends MigrateDrupal6TestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$migration = entity_load('migration', 'd6_system_image_gd');
|
||||
$dumps = array(
|
||||
$this->getDumpDirectory() . '/Variable.php',
|
||||
);
|
||||
$this->prepare($migration, $dumps);
|
||||
$executable = new MigrateExecutable($migration, new MigrateMessage());
|
||||
$executable->import();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests migration of system (image GD) variables to system.image.gd.yml.
|
||||
*/
|
||||
public function testSystemImageGd() {
|
||||
$config = $this->config('system.image.gd');
|
||||
$this->assertIdentical(75, $config->get('jpeg_quality'));
|
||||
}
|
||||
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Tests\d6\MigrateSystemImageTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\migrate\MigrateMessage;
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Upgrade image variables to system.*.yml.
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class MigrateSystemImageTest extends MigrateDrupal6TestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$migration = entity_load('migration', 'd6_system_image');
|
||||
$dumps = array(
|
||||
$this->getDumpDirectory() . '/Variable.php',
|
||||
);
|
||||
$this->prepare($migration, $dumps);
|
||||
$executable = new MigrateExecutable($migration, new MigrateMessage());
|
||||
$executable->import();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests migration of system (image) variables to system.image.yml.
|
||||
*/
|
||||
public function testSystemImage() {
|
||||
$config = $this->config('system.image');
|
||||
$this->assertIdentical('gd', $config->get('toolkit'));
|
||||
}
|
||||
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Tests\d6\MigrateSystemLoggingTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\config\Tests\SchemaCheckTestTrait;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Upgrade error_level variable to system.logging.yml.
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class MigrateSystemLoggingTest extends MigrateDrupal6TestBase {
|
||||
|
||||
use SchemaCheckTestTrait;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$migration = entity_load('migration', 'd6_system_logging');
|
||||
$dumps = array(
|
||||
$this->getDumpDirectory() . '/Variable.php',
|
||||
);
|
||||
$this->prepare($migration, $dumps);
|
||||
$executable = new MigrateExecutable($migration, $this);
|
||||
$executable->import();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests migration of system error_level variables to system.logging.yml.
|
||||
*/
|
||||
public function testSystemLogging() {
|
||||
$config = $this->config('system.logging');
|
||||
$this->assertIdentical('some', $config->get('error_level'));
|
||||
$this->assertConfigSchema(\Drupal::service('config.typed'), 'system.logging', $config->get());
|
||||
}
|
||||
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Tests\d6\MigrateSystemMaintenanceTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\migrate\MigrateMessage;
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Upgrade maintenance variables to system.*.yml.
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class MigrateSystemMaintenanceTest extends MigrateDrupal6TestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$migration = entity_load('migration', 'd6_system_maintenance');
|
||||
$dumps = array(
|
||||
$this->getDumpDirectory() . '/Variable.php',
|
||||
);
|
||||
$this->prepare($migration, $dumps);
|
||||
$executable = new MigrateExecutable($migration, new MigrateMessage());
|
||||
$executable->import();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests migration of system (maintenance) variables to system.maintenance.yml.
|
||||
*/
|
||||
public function testSystemMaintenance() {
|
||||
$config = $this->config('system.maintenance');
|
||||
$this->assertIdentical('Drupal is currently under maintenance. We should be back shortly. Thank you for your patience.', $config->get('message'));
|
||||
}
|
||||
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Tests\d6\MigrateSystemPerformanceTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\migrate\MigrateMessage;
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Upgrade performance variables to system.*.yml.
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class MigrateSystemPerformanceTest extends MigrateDrupal6TestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$migration = entity_load('migration', 'd6_system_performance');
|
||||
$dumps = array(
|
||||
$this->getDumpDirectory() . '/Variable.php',
|
||||
);
|
||||
$this->prepare($migration, $dumps);
|
||||
$executable = new MigrateExecutable($migration, new MigrateMessage());
|
||||
$executable->import();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests migration of system (Performance) variables to system.performance.yml.
|
||||
*/
|
||||
public function testSystemPerformance() {
|
||||
$config = $this->config('system.performance');
|
||||
$this->assertIdentical(FALSE, $config->get('css.preprocess'));
|
||||
$this->assertIdentical(FALSE, $config->get('js.preprocess'));
|
||||
$this->assertIdentical(0, $config->get('cache.page.max_age'));
|
||||
}
|
||||
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Tests\d6\MigrateSystemRssTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Tests\d6;
|
||||
|
||||
use Drupal\migrate\MigrateMessage;
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Upgrade rss variable to system.*.yml.
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class MigrateSystemRssTest extends MigrateDrupal6TestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$migration = entity_load('migration', 'd6_system_rss');
|
||||
$dumps = array(
|
||||
$this->getDumpDirectory() . '/Variable.php',
|
||||
);
|
||||
$this->prepare($migration, $dumps);
|
||||
$executable = new MigrateExecutable($migration, new MigrateMessage());
|
||||
$executable->import();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests migration of system (rss) variables to system.rss.yml.
|
||||
*/
|
||||
public function testSystemRss() {
|
||||
$config = $this->config('system.rss');
|
||||
$this->assertIdentical(10, $config->get('items.limit'));
|
||||
$this->assertIdentical('title', $config->get('items.view_mode'));
|
||||
}
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Reference in a new issue