Issue #2249149 by ultimike, benjy | chx: Create a system_logging migration.

8.0.x
Alex Pott 2014-07-07 12:26:57 +01:00
parent 49d64895a2
commit 421123a390
3 changed files with 105 additions and 0 deletions

View File

@ -0,0 +1,19 @@
id: d6_system_logging
label: Drupal 6 system logging
source:
plugin: variable
variables:
- error_level
process:
error_level:
plugin: static_map
source: error_level
default_value: all
map:
0: hide
1: some
2: all
3: verbose
destination:
plugin: config
config_name: system.logging

View File

@ -0,0 +1,31 @@
<?php
/**
* @file
* Contains \Drupal\migrate_drupal\Tests\Dump\Drupal6SystemLogging.
*/
namespace Drupal\migrate_drupal\Tests\Dump;
/**
* Database dump for testing system.logging.yml migration.
*/
class Drupal6SystemLogging extends Drupal6DumpBase {
/**
* {@inheritdoc}
*/
public function load() {
$this->createTable('variable');
$this->database->insert('variable')->fields(array(
'name',
'value',
))
->values(array(
'name' => 'error_level',
'value' => serialize(1),
))
->execute();
}
}

View File

@ -0,0 +1,55 @@
<?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\MigrateDrupalTestBase;
/**
* Tests migration of system error_level variables to configuration.
*/
class MigrateSystemLoggingTest extends MigrateDrupalTestBase {
use SchemaCheckTestTrait;
/**
* {@inheritdoc}
*/
public static function getInfo() {
return array(
'name' => 'Migrate error_level variable to system.logging.yml',
'description' => 'Upgrade error_level variable to system.logging.yml',
'group' => 'Migrate Drupal',
);
}
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$migration = entity_load('migration', 'd6_system_logging');
$dumps = array(
$this->getDumpDirectory() . '/Drupal6SystemLogging.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 = \Drupal::config('system.logging');
$this->assertIdentical($config->get('error_level'), 'some');
$this->assertConfigSchema(\Drupal::service('config.typed'), 'system.logging', $config->get());
}
}