Commit acb96c01 authored by alexpott's avatar alexpott
Browse files

Issue #2293419 by vijaycs85: Fixed Add config schema test to all configuration...

Issue #2293419 by vijaycs85: Fixed Add config schema test to all configuration test in migration, fix bugs.
parent cebfd8ec
......@@ -10,7 +10,6 @@ source:
- aggregator_teaser_length
- aggregator_clear
- aggregator_summary_items
- aggregator_category_selector
process:
fetcher: aggregator_fetcher
parser: aggregator_parser
......@@ -19,7 +18,6 @@ process:
'items.teaser_length': aggregator_teaser_length
'items.expire': aggregator_clear
'source.list_max': aggregator_summary_items
'source.category_selector': aggregator_category_selector
destination:
plugin: config
config_name: aggregator.settings
......@@ -76,9 +76,3 @@ process:
destination:
plugin: entity:field_config
migration_dependencies:
optional:
# It is not possible to make this required as d6_field_settings has no
# source id. However it also has no required dependencies so it will always
# run so an optional dependency is enough.
- d6_field_settings
id: d6_field_settings
label: Drupal 6 global field configuration
source:
plugin: variable
variables:
- field_language_fallback
process:
language_fallback: field_language_fallback
destination:
plugin: config
config_name: field.settings
......@@ -6,7 +6,7 @@ source:
- locale_cache_strings
- locale_js_directory
process:
cache_string: locale_cache_strings
cache_strings: locale_cache_strings
'javascript.directory': locale_js_directory
destination:
plugin: config
......
......@@ -10,7 +10,7 @@ source:
- statistics_block_top_all_num
- statistics_block_top_last_num
process:
'access_log.enable': statistics_enable_access_log
'access_log.enabled': statistics_enable_access_log
'access_log.max_lifetime': statistics_flush_accesslog_timer
'count_content_views': statistics_count_content_views
'block.popular.top_day_limit': statistics_block_top_day_num
......
......@@ -11,7 +11,7 @@ process:
'fetch.max_attempts': update_max_fetch_attempts
'fetch.url': update_fetch_url
'notification.threshold': update_notification_threshold
'notification.mails': update_notify_emails
'notification.emails': update_notify_emails
destination:
plugin: config
config_name: update.settings
......@@ -49,10 +49,6 @@ public function load() {
'name' => 'aggregator_summary_items',
'value' => 's:1:"3";',
))
->values(array(
'name' => 'aggregator_category_selector',
'value' => 's:10:"checkboxes";',
))
->execute();
}
}
<?php
/**
* @file
* Contains \Drupal\migrate_drupal\Tests\Dump\Drupal6FieldSettings.
*/
namespace Drupal\migrate_drupal\Tests\Dump;
/**
* Database dump for testing field.settings.yml migration.
*/
class Drupal6FieldSettings extends Drupal6DumpBase {
/**
* {@inheritdoc}
*/
public function load() {
$this->createTable('variable');
$this->database->insert('variable')->fields(array(
'name',
'value',
))
->values(array(
'name' => 'field_language_fallback',
'value' => 'b:1;',
))
->execute();
}
}
<?php
/**
* @file
* Contains \Drupal\migrate_drupal\Tests\d6\MigrateActionConfigSchemaTest.
*/
namespace Drupal\migrate_drupal\Tests\d6;
use Drupal\config\Tests\SchemaCheckTestTrait;
use Drupal\migrate\MigrateExecutable;
use Drupal\migrate_drupal\Tests\MigrateDrupalTestBase;
/**
* Tests the language config schema.
*/
class MigrateActionConfigSchemaTest extends MigrateDrupalTestBase {
use SchemaCheckTestTrait;
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('action');
/**
* {@inheritdoc}
*/
public static function getInfo() {
return array(
'name' => 'Migrate action configuration schema',
'description' => 'Tests the configuration schema of action module',
'group' => 'Migrate Drupal',
);
}
/**
* {@inheritdoc}
*/
public function setUp() {
parent::setUp();
$migration = entity_load('migration', 'd6_action_settings');
$dumps = array(
$this->getDumpDirectory() . '/Drupal6ActionSettings.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, $this);
$executable->import();
}
/**
* Tests migration of action variables to action.settings.yml.
*/
public function testActionConfigSchema() {
$config_data = \Drupal::config('action.settings')->get();
$this->assertConfigSchema(\Drupal::service('config.typed'), 'action.settings', $config_data);
}
}
......@@ -7,6 +7,7 @@
namespace Drupal\migrate_drupal\Tests\d6;
use Drupal\config\Tests\SchemaCheckTestTrait;
use Drupal\migrate\MigrateExecutable;
use Drupal\migrate_drupal\Tests\MigrateDrupalTestBase;
......@@ -15,6 +16,8 @@
*/
class MigrateActionConfigsTest extends MigrateDrupalTestBase {
use SchemaCheckTestTrait;
/**
* Modules to enable.
*
......@@ -53,6 +56,7 @@ public function setUp() {
public function testActionSettings() {
$config = \Drupal::config('action.settings');
$this->assertIdentical($config->get('recursion_limit'), 35);
$this->assertConfigSchema(\Drupal::service('config.typed'), 'action.settings', $config->get());
}
}
......@@ -7,6 +7,7 @@
namespace Drupal\migrate_drupal\Tests\d6;
use Drupal\config\Tests\SchemaCheckTestTrait;
use Drupal\migrate\MigrateExecutable;
use Drupal\migrate_drupal\Tests\MigrateDrupalTestBase;
......@@ -15,6 +16,8 @@
*/
class MigrateAggregatorConfigsTest extends MigrateDrupalTestBase {
use SchemaCheckTestTrait;
/**
* Modules to enable.
*
......@@ -59,7 +62,7 @@ public function testAggregatorSettings() {
$this->assertIdentical($config->get('items.allowed_html'), '<a> <b> <br /> <dd> <dl> <dt> <em> <i> <li> <ol> <p> <strong> <u> <ul>');
$this->assertIdentical($config->get('items.expire'), 9676800);
$this->assertIdentical($config->get('source.list_max'), 3);
$this->assertIdentical($config->get('source.category_selector'), 'checkboxes');
$this->assertConfigSchema(\Drupal::service('config.typed'), 'aggregator.settings', $config->get());
}
}
......@@ -7,6 +7,7 @@
namespace Drupal\migrate_drupal\Tests\d6;
use Drupal\config\Tests\SchemaCheckTestTrait;
use Drupal\migrate\MigrateMessage;
use Drupal\migrate\MigrateExecutable;
use Drupal\migrate_drupal\Tests\MigrateDrupalTestBase;
......@@ -16,6 +17,8 @@
*/
class MigrateBookConfigsTest extends MigrateDrupalTestBase {
use SchemaCheckTestTrait;
/**
* Modules to enable.
*
......@@ -56,5 +59,7 @@ public function testBookSettings() {
$this->assertIdentical($config->get('child_type'), 'book');
$this->assertIdentical($config->get('block.navigation.mode'), 'all pages');
$this->assertIdentical($config->get('allowed_types'), array('book'));
$this->assertConfigSchema(\Drupal::service('config.typed'), 'book.settings', $config->get());
}
}
......@@ -7,6 +7,7 @@
namespace Drupal\migrate_drupal\Tests\d6;
use Drupal\config\Tests\SchemaCheckTestTrait;
use Drupal\migrate\MigrateMessage;
use Drupal\migrate\MigrateExecutable;
use Drupal\migrate_drupal\Tests\MigrateDrupalTestBase;
......@@ -16,6 +17,8 @@
*/
class MigrateContactConfigsTest extends MigrateDrupalTestBase {
use SchemaCheckTestTrait;
/**
* Modules to enable.
*
......@@ -65,5 +68,7 @@ public function testContactSettings() {
$this->assertIdentical($config->get('user_default_enabled'), true);
$this->assertIdentical($config->get('flood.limit'), 3);
$this->assertIdentical($config->get('default_category'), 'some_other_category');
$this->assertConfigSchema(\Drupal::service('config.typed'), 'contact.settings', $config->get());
}
}
......@@ -7,6 +7,7 @@
namespace Drupal\migrate_drupal\Tests\d6;
use Drupal\config\Tests\SchemaCheckTestTrait;
use Drupal\migrate\MigrateMessage;
use Drupal\migrate\MigrateExecutable;
use Drupal\migrate_drupal\Tests\MigrateDrupalTestBase;
......@@ -16,6 +17,8 @@
*/
class MigrateDblogConfigsTest extends MigrateDrupalTestBase {
use SchemaCheckTestTrait;
/**
* Modules to enable.
*
......@@ -54,5 +57,7 @@ public function setUp() {
public function testBookSettings() {
$config = \Drupal::config('dblog.settings');
$this->assertIdentical($config->get('row_limit'), 1000);
$this->assertConfigSchema(\Drupal::service('config.typed'), 'dblog.settings', $config->get());
}
}
......@@ -39,6 +39,7 @@ class MigrateDrupal6Test extends MigrateFullDrupalTestBase {
'options',
'search',
'simpletest',
'statistics',
'syslog',
'taxonomy',
'telephone',
......@@ -75,7 +76,6 @@ class MigrateDrupal6Test extends MigrateFullDrupalTestBase {
'd6_field',
'd6_field_instance',
'd6_field_instance_widget_settings',
'd6_field_settings',
'd6_field_formatter_settings',
'd6_file_settings',
'd6_file',
......@@ -167,7 +167,6 @@ protected function getDumps() {
$tests_path . '/Drupal6DateFormat.php',
$tests_path . '/Drupal6DblogSettings.php',
$tests_path . '/Drupal6FieldInstance.php',
$tests_path . '/Drupal6FieldSettings.php',
$tests_path . '/Drupal6File.php',
$tests_path . '/Drupal6FileSettings.php',
$tests_path . '/Drupal6FilterFormat.php',
......@@ -240,7 +239,6 @@ protected function getTestClassesList() {
__NAMESPACE__ . '\MigrateBlockContentTest',
__NAMESPACE__ . '\MigrateDateFormatTest',
__NAMESPACE__ . '\MigrateDblogConfigsTest',
__NAMESPACE__ . '\MigrateFieldConfigsTest',
__NAMESPACE__ . '\MigrateFieldTest',
__NAMESPACE__ . '\MigrateFieldInstanceTest',
__NAMESPACE__ . '\MigrateFieldFormatterSettingsTest',
......
<?php
/**
* @file
* Contains \Drupal\migrate_drupal\Tests\d6\MigrateFieldConfigsTest.
*/
namespace Drupal\migrate_drupal\Tests\d6;
use Drupal\migrate\MigrateExecutable;
use Drupal\migrate_drupal\Tests\MigrateDrupalTestBase;
/**
* Tests migration of variables from the Field module.
*/
class MigrateFieldConfigsTest extends MigrateDrupalTestBase {
/**
* {@inheritdoc}
*/
public static function getInfo() {
return array(
'name' => 'Migrate variables to field.settings.yml',
'description' => 'Upgrade variables to field.settings.yml',
'group' => 'Migrate Drupal',
);
}
/**
* {@inheritdoc}
*/
public function setUp() {
parent::setUp();
$migration = entity_load('migration', 'd6_field_settings');
$dumps = array(
$this->getDumpDirectory() . '/Drupal6FieldSettings.php',
);
$this->prepare($migration, $dumps);
$executable = new MigrateExecutable($migration, $this);
$executable->import();
}
/**
* Tests migration of field variables to field.settings.yml.
*/
public function testFieldSettings() {
$config = \Drupal::config('field.settings');
$this->assertIdentical($config->get('language_fallback'), TRUE);
}
}
......@@ -7,6 +7,7 @@
namespace Drupal\migrate_drupal\Tests\d6;
use Drupal\config\Tests\SchemaCheckTestTrait;
use Drupal\migrate\MigrateMessage;
use Drupal\migrate\MigrateExecutable;
use Drupal\migrate_drupal\Tests\MigrateDrupalTestBase;
......@@ -16,6 +17,8 @@
*/
class MigrateFileConfigsTest extends MigrateDrupalTestBase {
use SchemaCheckTestTrait;
/**
* Modules to enable.
*
......@@ -56,5 +59,7 @@ public function testFileSettings() {
$this->assertIdentical($config->get('description.type'), 'textfield');
$this->assertIdentical($config->get('description.length'), 128);
$this->assertIdentical($config->get('icon.directory'), 'sites/default/files/icons');
$this->assertConfigSchema(\Drupal::service('config.typed'), 'file.settings', $config->get());
}
}
......@@ -7,6 +7,7 @@
namespace Drupal\migrate_drupal\Tests\d6;
use Drupal\config\Tests\SchemaCheckTestTrait;
use Drupal\migrate\MigrateExecutable;
use Drupal\migrate_drupal\Tests\MigrateDrupalTestBase;
......@@ -15,6 +16,8 @@
*/
class MigrateForumConfigsTest extends MigrateDrupalTestBase {
use SchemaCheckTestTrait;
/**
* Modules to enable.
*
......@@ -61,5 +64,7 @@ public function testForumSettings() {
$this->assertIdentical($config->get('block.active.limit'), 5);
// This is 'forum_block_num_1' in D6, but 'block:new:limit' in D8.
$this->assertIdentical($config->get('block.new.limit'), 5);
$this->assertConfigSchema(\Drupal::service('config.typed'), 'forum.settings', $config->get());
}
}
......@@ -7,6 +7,7 @@
namespace Drupal\migrate_drupal\Tests\d6;
use Drupal\config\Tests\SchemaCheckTestTrait;
use Drupal\migrate\MigrateExecutable;
use Drupal\migrate_drupal\Tests\MigrateDrupalTestBase;
......@@ -15,6 +16,8 @@
*/
class MigrateLocaleConfigsTest extends MigrateDrupalTestBase {
use SchemaCheckTestTrait;
/**
* Modules to enable.
*
......@@ -52,8 +55,9 @@ public function setUp() {
*/
public function testLocaleSettings() {
$config = \Drupal::config('locale.settings');
$this->assertIdentical($config->get('cache_string'), 1);
$this->assertIdentical($config->get('cache_strings'), TRUE);
$this->assertIdentical($config->get('javascript.directory'), 'languages');
$this->assertConfigSchema(\Drupal::service('config.typed'), 'locale.settings', $config->get());
}
}
......@@ -7,6 +7,7 @@
namespace Drupal\migrate_drupal\Tests\d6;
use Drupal\config\Tests\SchemaCheckTestTrait;
use Drupal\migrate\MigrateExecutable;
use Drupal\migrate_drupal\Tests\MigrateDrupalTestBase;
......@@ -15,6 +16,8 @@
*/
class MigrateMenuConfigsTest extends MigrateDrupalTestBase {
use SchemaCheckTestTrait;
/**
* Modules to enable.
*
......@@ -55,5 +58,7 @@ public function testMenuSettings() {
$this->assertIdentical($config->get('main_links'), 'primary-links');
$this->assertIdentical($config->get('secondary_links'), 'secondary-links');
$this->assertIdentical($config->get('override_parent_selector'), FALSE);
$this->assertConfigSchema(\Drupal::service('config.typed'), 'menu_ui.settings', $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