Commit 76ecad77 authored by catch's avatar catch

Issue #2824183 by quietone, phenaproxima: Consolidate D6 migration system tests

parent fbafc692
<?php
namespace Drupal\Tests\system\Kernel\Migrate\d6;
use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
/**
* Migrates various configuration objects owned by the System module.
*
* @group migrate_drupal_6
*/
class MigrateSystemConfigurationTest extends MigrateDrupal6TestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['action', 'file', 'system'];
protected $expectedConfig = [
'system.cron' => [
'threshold' => [
'requirements_warning' => 172800,
'requirements_error' => 1209600,
],
// logging is not handled by the migration.
'logging' => 1,
],
'system.date' => [
// country is not handled by the migration.
'country' => [
'default' => '',
],
'first_day' => 4,
// timezone is not handled by the migration.
'timezone' => [
'default' => 'Europe/Paris',
'user' => [
'configurable' => FALSE,
// warn is not handled by the migration.
'warn' => FALSE,
// default is not handled by the migration.
'default' => 0,
],
],
],
'system.file' => [
'allow_insecure_uploads' => TRUE,
// default_scheme is not handled by the migration.
'default_scheme' => 'public',
'path' => [
'temporary' => 'files/temp',
],
// temporary_maximum_age is not handled by the migration.
'temporary_maximum_age' => 21600,
],
'system.image.gd' => [
'jpeg_quality' => 75,
],
'system.image' => [
'toolkit' => 'gd',
],
'system.logging' => [
'error_level' => 'some',
],
'system.maintenance' => [
'message' => 'Drupal is currently under maintenance. We should be back shortly. Thank you for your patience.',
// langcode is not handled by the migration.
'langcode' => 'en',
],
'system.performance' => [
'cache' => [
'page' => [
'max_age' => 0,
],
],
'css' => [
'preprocess' => FALSE,
// gzip is not handled by the migration.
'gzip' => TRUE,
],
// fast_404 is not handled by the migration.
'fast_404' => [
'enabled' => TRUE,
'paths' => '/\.(?:txt|png|gif|jpe?g|css|js|ico|swf|flv|cgi|bat|pl|dll|exe|asp)$/i',
'exclude_paths' => '/\/(?:styles|imagecache)\//',
'html' => '<!DOCTYPE html><html><head><title>404 Not Found</title></head><body><h1>Not Found</h1><p>The requested URL "@path" was not found on this server.</p></body></html>',
],
'js' => [
'preprocess' => FALSE,
// gzip is not handled by the migration.
'gzip' => TRUE,
],
// stale_file_threshold is not handled by the migration.
'stale_file_threshold' => 2592000,
'response' => [
'gzip' => TRUE,
],
],
'system.rss' => [
// channel is not handled by the migration.
'channel' => [
'description' => '',
],
'items' => [
'limit' => 10,
'view_mode' => 'title',
],
// langcode is not handled by the migration.
'langcode' => 'en',
],
'system.site' => [
// uuid is not handled by the migration.
'uuid' => '',
'name' => 'site_name',
'mail' => 'site_mail@example.com',
'slogan' => 'Migrate rocks',
'page' => [
'403' => '/user',
'404' => '/page-not-found',
'front' => '/node',
],
'admin_compact_mode' => FALSE,
'weight_select_max' => 100,
// langcode and default_langcode are not handled by the migration.
'langcode' => 'en',
'default_langcode' => 'en',
],
];
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$migrations = [
'd6_system_cron',
'd6_system_date',
'd6_system_file',
'system_image_gd',
'system_image',
'system_logging',
'system_maintenance',
'd6_system_performance',
'system_rss',
'system_site',
];
$this->executeMigrations($migrations);
}
/**
* Tests that all expected configuration gets migrated.
*/
public function testConfigurationMigration() {
foreach ($this->expectedConfig as $config_id => $values) {
$actual = \Drupal::config($config_id)->get();
unset($actual['_core']);
$this->assertSame($actual, $values, $config_id . ' matches expected values.');
}
}
}
<?php
namespace Drupal\Tests\system\Kernel\Migrate\d6;
use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
/**
* Upgrade cron variable to system.*.yml.
*
* @group migrate_drupal_6
*/
class MigrateSystemCronTest extends MigrateDrupal6TestBase {
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->executeMigration('d6_system_cron');
}
/**
* 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'));
}
}
<?php
namespace Drupal\Tests\system\Kernel\Migrate\d6;
use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
/**
* Upgrade date time variables to system.date config
*
* @group migrate_drupal_6
*/
class MigrateSystemDateTest extends MigrateDrupal6TestBase {
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->executeMigration('d6_system_date');
}
/**
* Tests migration of user variables to system_date.yml.
*/
public function testSystemDate() {
$config = $this->config('system.date');
$this->assertIdentical(4, $config->get('first_day'));
$this->assertIdentical(FALSE, $config->get('timezone.user.configurable'));
$this->assertIdentical("Europe/Paris", $config->get('timezone.default'));
}
}
<?php
namespace Drupal\Tests\system\Kernel\Migrate\d6;
use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
/**
* Upgrade variables to system.*.yml.
*
* @group migrate_drupal_6
*/
class MigrateSystemFileTest extends MigrateDrupal6TestBase {
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->executeMigration('d6_system_file');
}
/**
* 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'));
}
}
<?php
namespace Drupal\Tests\system\Kernel\Migrate\d6;
use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
/**
* Upgrade image gd variables to system.*.yml.
*
* @group migrate_drupal_6
*/
class MigrateSystemImageGdTest extends MigrateDrupal6TestBase {
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->executeMigration('system_image_gd');
}
/**
* 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'));
}
}
<?php
namespace Drupal\Tests\system\Kernel\Migrate\d6;
use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
/**
* Upgrade image variables to system.*.yml.
*
* @group migrate_drupal_6
*/
class MigrateSystemImageTest extends MigrateDrupal6TestBase {
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->executeMigration('system_image');
}
/**
* Tests migration of system (image) variables to system.image.yml.
*/
public function testSystemImage() {
$config = $this->config('system.image');
$this->assertIdentical('gd', $config->get('toolkit'));
}
}
<?php
namespace Drupal\Tests\system\Kernel\Migrate\d6;
use Drupal\Tests\SchemaCheckTestTrait;
use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
/**
* Upgrade error_level variable to system.logging.yml.
*
* @group migrate_drupal_6
*/
class MigrateSystemLoggingTest extends MigrateDrupal6TestBase {
use SchemaCheckTestTrait;
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->executeMigration('system_logging');
}
/**
* 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());
}
}
<?php
namespace Drupal\Tests\system\Kernel\Migrate\d6;
use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
/**
* Upgrade maintenance variables to system.*.yml.
*
* @group migrate_drupal_6
*/
class MigrateSystemMaintenanceTest extends MigrateDrupal6TestBase {
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->executeMigration('system_maintenance');
}
/**
* 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'));
}
}
<?php
namespace Drupal\Tests\system\Kernel\Migrate\d6;
use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
/**
* Upgrade performance variables to system.*.yml.
*
* @group migrate_drupal_6
*/
class MigrateSystemPerformanceTest extends MigrateDrupal6TestBase {
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->executeMigration('d6_system_performance');
}
/**
* 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'));
}
}
<?php
namespace Drupal\Tests\system\Kernel\Migrate\d6;
use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
/**
* Upgrade rss variable to system.*.yml.
*
* @group migrate_drupal_6
*/
class MigrateSystemRssTest extends MigrateDrupal6TestBase {
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->executeMigration('system_rss');
}
/**
* 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'));
}
}
<?php
namespace Drupal\Tests\system\Kernel\Migrate\d6;
use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
/**
* Upgrade site variables to system.*.yml.
*
* @group migrate_drupal_6
*/
class MigrateSystemSiteTest extends MigrateDrupal6TestBase {
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->executeMigration('system_site');
}
/**
* Tests migration of system (site) variables to system.site.yml.
*/
public function testSystemSite() {
$config = $this->config('system.site');
$this->assertIdentical('site_name', $config->get('name'));
$this->assertIdentical('site_mail@example.com', $config->get('mail'));
$this->assertIdentical('Migrate rocks', $config->get('slogan'));
$this->assertIdentical('/user', $config->get('page.403'));
$this->assertIdentical('/page-not-found', $config->get('page.404'));
$this->assertIdentical('/node', $config->get('page.front'));
$this->assertIdentical(FALSE, $config->get('admin_compact_mode'));
}
}
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