Issue #2143405 by chx, bdone: Split migrate into to migrate and migrate_drupal.

8.0.x
Nathaniel Catchpole 2013-12-02 12:37:57 +00:00
parent b5525adbac
commit 7bad5758a4
15 changed files with 136 additions and 18 deletions

View File

@ -0,0 +1,14 @@
id: d6_system_performance
source:
plugin: drupal6_variable
variables:
- preprocess_css
- preprocess_js
- cache_lifetime
process:
'css:preprocess': preprocess_css
'js:preprocess': preprocess_js
'cache:page:max_age': cache_lifetime
destination:
plugin: d8_config
config_name: system.performance

View File

@ -5,10 +5,10 @@
* Contains \Drupal\migrate\Plugin\migrate\source\d6\Variable.
*/
namespace Drupal\migrate\Plugin\migrate\source;
namespace Drupal\migrate_drupal\Plugin\migrate\source;
use Drupal\migrate\Entity\MigrationInterface;
use Drupal\migrate\Plugin\migrate\source\d6\Drupal6SqlBase;
use Drupal\migrate_drupal\Plugin\migrate\source\d6\Drupal6SqlBase;
/**
* Drupal 6 variable source from database.

View File

@ -5,7 +5,7 @@
* Contains \Drupal\migrate\Plugin\migrate\source\d6\Drupal6SqlBase.
*/
namespace Drupal\migrate\Plugin\migrate\source\d6;
namespace Drupal\migrate_drupal\Plugin\migrate\source\d6;
use Drupal\migrate\Plugin\migrate\source\SqlBase;

View File

@ -5,7 +5,7 @@
* Contains \Drupal\migrate\Tests\Drupal6SystemCron.
*/
namespace Drupal\migrate\Tests\Dump;
namespace Drupal\migrate_drupal\Tests\Dump;
use Drupal\Core\Database\Connection;

View File

@ -0,0 +1,64 @@
<?php
/**
* @file
* Contains \Drupal\migrate\Tests\Drupal6SystemPerformance.
*/
namespace Drupal\migrate_drupal\Tests\Dump;
use Drupal\Core\Database\Connection;
/**
* Database dump for testing system.performance.yml migration.
*/
class Drupal6SystemPerformance {
/**
* Sample database schema and values.
*
* @param \Drupal\Core\Database\Connection $database
* The database connection.
*/
public static function load(Connection $database) {
$database->schema()->createTable('variable', array(
'fields' => array(
'name' => array(
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
),
'value' => array(
'type' => 'blob',
'not null' => TRUE,
'size' => 'big',
'translatable' => TRUE,
),
),
'primary key' => array(
'name',
),
'module' => 'system',
'name' => 'variable',
));
$database->insert('variable')->fields(array(
'name',
'value',
))
->values(array(
'name' => 'preprocess_css',
'value' => 'i:0;',
))
->values(array(
'name' => 'preprocess_js',
'value' => 'i:0;',
))
->values(array(
'name' => 'cache_lifetime',
'value' => 'i:0;',
))
->execute();
}
}

View File

@ -5,7 +5,7 @@
* Contains \Drupal\migrate\Tests\Drupal6SystemRss.
*/
namespace Drupal\migrate\Tests\Dump;
namespace Drupal\migrate_drupal\Tests\Dump;
use Drupal\Core\Database\Connection;

View File

@ -1,6 +1,6 @@
<?php
namespace Drupal\migrate\Tests\Dump;
namespace Drupal\migrate_drupal\Tests\Dump;
use Drupal\Core\Database\Connection;

View File

@ -0,0 +1,15 @@
<?php
/**
* @file
* Contains \Drupal\migrate_drupal\Tests\MigrateDrupalTestBase.
*/
namespace Drupal\migrate_drupal\Tests;
use Drupal\migrate\Tests\MigrateTestBase;
class MigrateDrupalTestBase extends MigrateTestBase {
public static $modules = array('migrate_drupal');
}

View File

@ -5,12 +5,12 @@
* Contains \Drupal\system\Tests\Upgrade\MigrateSystemSiteTest.
*/
namespace Drupal\migrate\Tests;
namespace Drupal\migrate_drupal\Tests;
use Drupal\migrate\MigrateMessage;
use Drupal\migrate\MigrateExecutable;
class MigrateSystemConfigsTest extends MigrateTestBase {
class MigrateSystemConfigsTest extends MigrateDrupalTestBase {
/**
* {@inheritdoc}
@ -19,14 +19,14 @@ class MigrateSystemConfigsTest extends MigrateTestBase {
return array(
'name' => 'Migrate variables to system.*.yml',
'description' => 'Upgrade variables to system.*.yml',
'group' => 'Migrate',
'group' => 'Migrate Drupal',
);
}
function testSystemSite() {
$migration = entity_load('migration', 'd6_system_site');
$dumps = array(
drupal_get_path('module', 'migrate') . '/lib/Drupal/migrate/Tests/Dump/Drupal6SystemSite.php',
drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SystemSite.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, new MigrateMessage);
@ -48,7 +48,7 @@ class MigrateSystemConfigsTest extends MigrateTestBase {
public function testSystemCron() {
$migration = entity_load('migration', 'd6_system_cron');
$dumps = array(
drupal_get_path('module', 'migrate') . '/lib/Drupal/migrate/Tests/Dump/Drupal6SystemCron.php',
drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SystemCron.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, new MigrateMessage());
@ -64,7 +64,7 @@ class MigrateSystemConfigsTest extends MigrateTestBase {
public function testSystemRss() {
$migration = entity_load('migration', 'd6_system_rss');
$dumps = array(
drupal_get_path('module', 'migrate') . '/lib/Drupal/migrate/Tests/Dump/Drupal6SystemRss.php',
drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SystemRss.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, new MigrateMessage());
@ -72,4 +72,21 @@ class MigrateSystemConfigsTest extends MigrateTestBase {
$config = \Drupal::config('system.rss');
$this->assertIdentical($config->get('items.limit'), 10);
}
/**
* Tests migration of system (Performance) variables to system.performance.yml.
*/
public function testSystemPerformance() {
$migration = entity_load('migration', 'd6_system_performance');
$dumps = array(
drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SystemPerformance.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, new MigrateMessage());
$executable->import();
$config = \Drupal::config('system.performance');
$this->assertIdentical($config->get('css.preprocess'), 0);
$this->assertIdentical($config->get('js.preprocess'), 0);
$this->assertIdentical($config->get('cache.page.max_age'), 0);
}
}

View File

@ -0,0 +1,6 @@
name: Migrate Drupal
type: module
description: 'Contains migrations from olders Drupal versions.'
package: Core
version: VERSION
core: 8.x

View File

@ -5,15 +5,17 @@
* Contains \Drupal\migrate\Tests\D6VariableSourceTest.
*/
namespace Drupal\migrate\Tests;
namespace Drupal\migrate_drupal\Tests;
use Drupal\migrate\Tests\MigrateSqlSourceTestCase;
/**
* @group migrate
* @group migrate_drupal
* @group Drupal
*/
class D6VariableTest extends MigrateSqlSourceTestCase {
const PLUGIN_CLASS = 'Drupal\migrate\Plugin\migrate\source\D6Variable';
const PLUGIN_CLASS = 'Drupal\migrate_drupal\Plugin\migrate\source\D6Variable';
protected $migrationConfiguration = array(
'id' => 'test',
@ -53,17 +55,17 @@ class D6VariableTest extends MigrateSqlSourceTestCase {
return array(
'name' => 'D6 variable source functionality',
'description' => 'Tests D6 variable source plugin.',
'group' => 'Migrate',
'group' => 'Migrate Drupal',
);
}
}
namespace Drupal\migrate\Tests\source;
namespace Drupal\migrate_drupal\Tests\source;
use Drupal\Core\Database\Connection;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\migrate\Plugin\migrate\source\D6Variable;
use Drupal\migrate_drupal\Plugin\migrate\source\D6Variable;
class TestD6Variable extends D6Variable {
function setDatabase(Connection $database) {