Issue #2409453 by phenaproxima, hosef, chx: Variable to config: statistics.settings [d7]
parent
de94d5e20b
commit
f541fae97c
|
@ -328,6 +328,15 @@ class Variable extends DrupalDumpBase {
|
||||||
))->values(array(
|
))->values(array(
|
||||||
'name' => 'site_slogan',
|
'name' => 'site_slogan',
|
||||||
'value' => 's:10:"The Slogan";',
|
'value' => 's:10:"The Slogan";',
|
||||||
|
))->values(array(
|
||||||
|
'name' => 'statistics_block_top_all_num',
|
||||||
|
'value' => 'i:55;',
|
||||||
|
))->values(array(
|
||||||
|
'name' => 'statistics_block_top_day_num',
|
||||||
|
'value' => 'i:30;',
|
||||||
|
))->values(array(
|
||||||
|
'name' => 'statistics_block_top_last_num',
|
||||||
|
'value' => 'i:9;',
|
||||||
))->values(array(
|
))->values(array(
|
||||||
'name' => 'statistics_count_content_views',
|
'name' => 'statistics_count_content_views',
|
||||||
'value' => 'i:1;',
|
'value' => 'i:1;',
|
||||||
|
@ -470,4 +479,4 @@ class Variable extends DrupalDumpBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
#e0f7be890a222531c707941d0fedf479
|
#9023663998fea3fa823d287d8a53ab9f
|
||||||
|
|
|
@ -117,7 +117,7 @@ class MigrateDrupal6Test extends MigrateFullDrupalTestBase {
|
||||||
'd6_search_page',
|
'd6_search_page',
|
||||||
'd6_search_settings',
|
'd6_search_settings',
|
||||||
'd6_simpletest_settings',
|
'd6_simpletest_settings',
|
||||||
'd6_statistics_settings',
|
'statistics_settings',
|
||||||
'd6_syslog_settings',
|
'd6_syslog_settings',
|
||||||
'd6_system_cron',
|
'd6_system_cron',
|
||||||
'd6_system_file',
|
'd6_system_file',
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
id: statistics_popular_block_settings
|
||||||
|
label: Statistics popular block configuration
|
||||||
|
migration_tags:
|
||||||
|
- Drupal 6
|
||||||
|
- Drupal 7
|
||||||
|
source:
|
||||||
|
plugin: variable
|
||||||
|
variables:
|
||||||
|
- statistics_block_top_day_num
|
||||||
|
- statistics_block_top_all_num
|
||||||
|
- statistics_block_top_last_num
|
||||||
|
process:
|
||||||
|
top_day_num: statistics_block_top_day_num
|
||||||
|
top_all_num: statistics_block_top_all_num
|
||||||
|
top_last_num: statistics_block_top_last_num
|
||||||
|
destination:
|
||||||
|
plugin: config
|
||||||
|
config_name: block.settings.statistics_popular_block
|
|
@ -1,7 +1,8 @@
|
||||||
id: d6_statistics_settings
|
id: statistics_settings
|
||||||
label: Drupal 6 statistics configuration
|
label: Statistics configuration
|
||||||
migration_tags:
|
migration_tags:
|
||||||
- Drupal 6
|
- Drupal 6
|
||||||
|
- Drupal 7
|
||||||
source:
|
source:
|
||||||
plugin: variable
|
plugin: variable
|
||||||
variables:
|
variables:
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @file
|
||||||
* Contains \Drupal\statistics\Tests\Migrate\d6\MigrateStatisticsConfigsTest.
|
* Contains \Drupal\statistics\Tests\Migrate\MigrateStatisticsConfigsTest.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Drupal\statistics\Tests\Migrate\d6;
|
namespace Drupal\statistics\Tests\Migrate;
|
||||||
|
|
||||||
use Drupal\config\Tests\SchemaCheckTestTrait;
|
use Drupal\config\Tests\SchemaCheckTestTrait;
|
||||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||||
|
@ -32,7 +32,7 @@ class MigrateStatisticsConfigsTest extends MigrateDrupal6TestBase {
|
||||||
protected function setUp() {
|
protected function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
$this->loadDumps(['Variable.php']);
|
$this->loadDumps(['Variable.php']);
|
||||||
$this->executeMigration('d6_statistics_settings');
|
$this->executeMigration('statistics_settings');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -0,0 +1,45 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* Contains \Drupal\statistics\Tests\Migrate\MigrateStatisticsPopularBlockSettingsTest.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Drupal\statistics\Tests\Migrate;
|
||||||
|
|
||||||
|
use Drupal\config\Tests\SchemaCheckTestTrait;
|
||||||
|
use Drupal\migrate_drupal\Tests\d7\MigrateDrupal7TestBase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests migration of settings for the Popular block.
|
||||||
|
*
|
||||||
|
* @group statistics
|
||||||
|
*/
|
||||||
|
class MigrateStatisticsPopularBlockSettingsTest extends MigrateDrupal7TestBase {
|
||||||
|
|
||||||
|
use SchemaCheckTestTrait;
|
||||||
|
|
||||||
|
public static $modules = ['statistics'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
protected function setUp() {
|
||||||
|
parent::setUp();
|
||||||
|
$this->installConfig(['statistics']);
|
||||||
|
$this->loadDumps(['Variable.php']);
|
||||||
|
$this->executeMigration('statistics_popular_block_settings');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests migration of Popular block settings into configuration.
|
||||||
|
*/
|
||||||
|
public function testMigration() {
|
||||||
|
$config = \Drupal::config('block.settings.statistics_popular_block')->get();
|
||||||
|
$this->assertIdentical(55, $config['top_all_num']);
|
||||||
|
$this->assertIdentical(30, $config['top_day_num']);
|
||||||
|
$this->assertIdentical(9, $config['top_last_num']);
|
||||||
|
$this->assertConfigSchema(\Drupal::service('config.typed'), 'block.settings.statistics_popular_block', $config);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue