Commit 421123a3 authored by alexpott's avatar alexpott
Browse files

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

parent 49d64895
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
<?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();
}
}
<?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());
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment