diff --git a/core/modules/migrate_drupal/src/Tests/Table/d7/Variable.php b/core/modules/migrate_drupal/src/Tests/Table/d7/Variable.php index cef570ea0de08632f03c52a14bb506824b2614f8..1225737684404a44e6b6bec32f8f43e25ccf1ad9 100644 --- a/core/modules/migrate_drupal/src/Tests/Table/d7/Variable.php +++ b/core/modules/migrate_drupal/src/Tests/Table/d7/Variable.php @@ -328,6 +328,15 @@ public function load() { ))->values(array( 'name' => 'site_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( 'name' => 'statistics_count_content_views', 'value' => 'i:1;', @@ -470,4 +479,4 @@ public function load() { } } -#e0f7be890a222531c707941d0fedf479 +#9023663998fea3fa823d287d8a53ab9f diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateDrupal6Test.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateDrupal6Test.php index ac5a8367cc833e507a63f2dfe3e335befe2cb9a6..8ce97bb48196f92663818f7ad2c34567e8976204 100644 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateDrupal6Test.php +++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateDrupal6Test.php @@ -117,7 +117,7 @@ class MigrateDrupal6Test extends MigrateFullDrupalTestBase { 'd6_search_page', 'd6_search_settings', 'd6_simpletest_settings', - 'd6_statistics_settings', + 'statistics_settings', 'd6_syslog_settings', 'd6_system_cron', 'd6_system_file', diff --git a/core/modules/statistics/migration_templates/statistics_popular_block_settings.yml b/core/modules/statistics/migration_templates/statistics_popular_block_settings.yml new file mode 100644 index 0000000000000000000000000000000000000000..46a9ab20cc0e70b9aadd805331a761cca2823cea --- /dev/null +++ b/core/modules/statistics/migration_templates/statistics_popular_block_settings.yml @@ -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 diff --git a/core/modules/statistics/migration_templates/d6_statistics_settings.yml b/core/modules/statistics/migration_templates/statistics_settings.yml similarity index 86% rename from core/modules/statistics/migration_templates/d6_statistics_settings.yml rename to core/modules/statistics/migration_templates/statistics_settings.yml index a8820db2e1e43efefe1c6ecd783867f610688042..62c2c0612a003f75da90244e9ac8dfb908602ed1 100644 --- a/core/modules/statistics/migration_templates/d6_statistics_settings.yml +++ b/core/modules/statistics/migration_templates/statistics_settings.yml @@ -1,7 +1,8 @@ -id: d6_statistics_settings -label: Drupal 6 statistics configuration +id: statistics_settings +label: Statistics configuration migration_tags: - Drupal 6 + - Drupal 7 source: plugin: variable variables: diff --git a/core/modules/statistics/src/Tests/Migrate/d6/MigrateStatisticsConfigsTest.php b/core/modules/statistics/src/Tests/Migrate/MigrateStatisticsConfigsTest.php similarity index 85% rename from core/modules/statistics/src/Tests/Migrate/d6/MigrateStatisticsConfigsTest.php rename to core/modules/statistics/src/Tests/Migrate/MigrateStatisticsConfigsTest.php index ea0be9d4689e4da8eec31f7768f102db6e97897a..d5922e1c3749ac9cc9bc5b9ce557ae10e30bf1b1 100644 --- a/core/modules/statistics/src/Tests/Migrate/d6/MigrateStatisticsConfigsTest.php +++ b/core/modules/statistics/src/Tests/Migrate/MigrateStatisticsConfigsTest.php @@ -2,10 +2,10 @@ /** * @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\migrate_drupal\Tests\d6\MigrateDrupal6TestBase; @@ -32,7 +32,7 @@ class MigrateStatisticsConfigsTest extends MigrateDrupal6TestBase { protected function setUp() { parent::setUp(); $this->loadDumps(['Variable.php']); - $this->executeMigration('d6_statistics_settings'); + $this->executeMigration('statistics_settings'); } /** diff --git a/core/modules/statistics/src/Tests/Migrate/MigrateStatisticsPopularBlockSettingsTest.php b/core/modules/statistics/src/Tests/Migrate/MigrateStatisticsPopularBlockSettingsTest.php new file mode 100644 index 0000000000000000000000000000000000000000..fe7b6b3caf9d3aed4cf3ad59181cf8947f441058 --- /dev/null +++ b/core/modules/statistics/src/Tests/Migrate/MigrateStatisticsPopularBlockSettingsTest.php @@ -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); + } + +}