Issue #3281427 by quietone, nod_, deviantintegral, catch, Spokje: Update Block and Theme setting migrations to not use Bartik and Seven
parent
04f4673b64
commit
dd5741759c
|
@ -8,7 +8,6 @@ use Drupal\block\Entity\Block;
|
||||||
* Tests migration of aggregator block.
|
* Tests migration of aggregator block.
|
||||||
*
|
*
|
||||||
* @group aggregator
|
* @group aggregator
|
||||||
* @group legacy
|
|
||||||
*/
|
*/
|
||||||
class MigrateBlockTest extends MigrateDrupal6TestBase {
|
class MigrateBlockTest extends MigrateDrupal6TestBase {
|
||||||
|
|
||||||
|
@ -31,14 +30,14 @@ class MigrateBlockTest extends MigrateDrupal6TestBase {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
// Install the themes used for this test.
|
// Install the themes used for this test.
|
||||||
$this->container->get('theme_installer')->install(['bartik', 'test_theme']);
|
|
||||||
|
|
||||||
$this->installEntitySchema('block_content');
|
$this->installEntitySchema('block_content');
|
||||||
|
$this->container->get('theme_installer')->install(['olivero', 'test_theme']);
|
||||||
|
|
||||||
$this->installConfig(['block_content']);
|
$this->installConfig(['block_content']);
|
||||||
|
|
||||||
// Set Bartik as the default public theme.
|
// Set Olivero as the default public theme.
|
||||||
$config = $this->config('system.theme');
|
$config = $this->config('system.theme');
|
||||||
$config->set('default', 'bartik');
|
$config->set('default', 'olivero');
|
||||||
$config->save();
|
$config->save();
|
||||||
|
|
||||||
$this->executeMigrations([
|
$this->executeMigrations([
|
||||||
|
@ -92,7 +91,7 @@ class MigrateBlockTest extends MigrateDrupal6TestBase {
|
||||||
*/
|
*/
|
||||||
public function testBlockMigration() {
|
public function testBlockMigration() {
|
||||||
$blocks = Block::loadMultiple();
|
$blocks = Block::loadMultiple();
|
||||||
$this->assertCount(14, $blocks);
|
$this->assertCount(25, $blocks);
|
||||||
|
|
||||||
// Check aggregator block.
|
// Check aggregator block.
|
||||||
$settings = [
|
$settings = [
|
||||||
|
@ -103,7 +102,7 @@ class MigrateBlockTest extends MigrateDrupal6TestBase {
|
||||||
'block_count' => 7,
|
'block_count' => 7,
|
||||||
'feed' => '5',
|
'feed' => '5',
|
||||||
];
|
];
|
||||||
$this->assertEntity('aggregator', [], 'sidebar_second', 'bartik', -2, $settings);
|
$this->assertEntity('aggregator', [], 'sidebar', 'olivero', -2, $settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,12 +71,12 @@ process:
|
||||||
- region
|
- region
|
||||||
map:
|
map:
|
||||||
garland:
|
garland:
|
||||||
bartik:
|
olivero:
|
||||||
# Garland 6.x --> Bartik 8.x
|
# Garland 6.x --> Olivero
|
||||||
header: header
|
header: header
|
||||||
footer: footer_fifth
|
footer: footer_top
|
||||||
left: sidebar_first
|
left: sidebar
|
||||||
right: sidebar_second
|
right: sidebar
|
||||||
# If mapping fails, put the block in the content region.
|
# If mapping fails, put the block in the content region.
|
||||||
default_value: content
|
default_value: content
|
||||||
weight: weight
|
weight: weight
|
||||||
|
|
|
@ -74,17 +74,29 @@ process:
|
||||||
- region
|
- region
|
||||||
map:
|
map:
|
||||||
bartik:
|
bartik:
|
||||||
bartik:
|
# Bartik 7.x --> Olivero 9.4.x
|
||||||
# Bartik 7.x --> Bartik 8.x
|
olivero:
|
||||||
featured: featured_top
|
featured: highlighted
|
||||||
triptych_first: featured_bottom_first
|
triptych_first: content_below
|
||||||
triptych_middle: featured_bottom_second
|
triptych_middle: content_below
|
||||||
triptych_last: featured_bottom_third
|
triptych_last: content_below
|
||||||
footer_firstcolumn: footer_first
|
footer_firstcolumn: footer_top
|
||||||
footer_secondcolumn: footer_second
|
footer_secondcolumn: footer_top
|
||||||
footer_thirdcolumn: footer_third
|
footer_thirdcolumn: footer_top
|
||||||
footer_fourthcolumn: footer_fourth
|
footer_fourthcolumn: footer_top
|
||||||
footer: footer_fifth
|
footer: footer_bottom
|
||||||
|
seven:
|
||||||
|
# Seven 7.x --> Claro 9.4.x
|
||||||
|
claro:
|
||||||
|
header: 'header'
|
||||||
|
pre_content: 'pre_content'
|
||||||
|
breadcrumb: 'breadcrumb'
|
||||||
|
highlighted: 'highlighted'
|
||||||
|
help: 'help'
|
||||||
|
content: 'content'
|
||||||
|
page_top: 'page_top'
|
||||||
|
page_bottom: 'page_bottom'
|
||||||
|
sidebar_first: 'sidebar_first'
|
||||||
# If mapping fails, put the block in the content region.
|
# If mapping fails, put the block in the content region.
|
||||||
default_value: content
|
default_value: content
|
||||||
weight: weight
|
weight: weight
|
||||||
|
|
|
@ -36,14 +36,14 @@ class MigrateBlockTest extends MigrateDrupal6TestBase {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
// Install the themes used for this test.
|
// Install the themes used for this test.
|
||||||
$this->container->get('theme_installer')->install(['bartik', 'test_theme']);
|
|
||||||
|
|
||||||
$this->installEntitySchema('block_content');
|
$this->installEntitySchema('block_content');
|
||||||
|
$this->container->get('theme_installer')->install(['olivero', 'test_theme']);
|
||||||
|
|
||||||
$this->installConfig(['block_content']);
|
$this->installConfig(['block_content']);
|
||||||
|
|
||||||
// Set Bartik as the default public theme.
|
// Set Olivero as the default public theme.
|
||||||
$config = $this->config('system.theme');
|
$config = $this->config('system.theme');
|
||||||
$config->set('default', 'bartik');
|
$config->set('default', 'olivero');
|
||||||
$config->save();
|
$config->save();
|
||||||
|
|
||||||
$this->executeMigrations([
|
$this->executeMigrations([
|
||||||
|
@ -97,7 +97,7 @@ class MigrateBlockTest extends MigrateDrupal6TestBase {
|
||||||
*/
|
*/
|
||||||
public function testBlockMigration() {
|
public function testBlockMigration() {
|
||||||
$blocks = Block::loadMultiple();
|
$blocks = Block::loadMultiple();
|
||||||
$this->assertCount(14, $blocks);
|
$this->assertCount(25, $blocks);
|
||||||
|
|
||||||
// Check user blocks.
|
// Check user blocks.
|
||||||
$visibility = [
|
$visibility = [
|
||||||
|
@ -113,7 +113,7 @@ class MigrateBlockTest extends MigrateDrupal6TestBase {
|
||||||
'provider' => 'user',
|
'provider' => 'user',
|
||||||
'label_display' => '0',
|
'label_display' => '0',
|
||||||
];
|
];
|
||||||
$this->assertEntity('user', $visibility, 'sidebar_first', 'bartik', -10, $settings);
|
$this->assertEntity('user', $visibility, 'sidebar', 'olivero', -10, $settings);
|
||||||
|
|
||||||
$visibility = [];
|
$visibility = [];
|
||||||
$settings = [
|
$settings = [
|
||||||
|
@ -125,7 +125,7 @@ class MigrateBlockTest extends MigrateDrupal6TestBase {
|
||||||
'expand_all_items' => FALSE,
|
'expand_all_items' => FALSE,
|
||||||
'depth' => 0,
|
'depth' => 0,
|
||||||
];
|
];
|
||||||
$this->assertEntity('user_1', $visibility, 'sidebar_first', 'bartik', -11, $settings);
|
$this->assertEntity('user_1', $visibility, 'sidebar', 'olivero', -11, $settings);
|
||||||
|
|
||||||
$visibility = [
|
$visibility = [
|
||||||
'user_role' => [
|
'user_role' => [
|
||||||
|
@ -146,7 +146,7 @@ class MigrateBlockTest extends MigrateDrupal6TestBase {
|
||||||
'label_display' => '0',
|
'label_display' => '0',
|
||||||
'items_per_page' => '5',
|
'items_per_page' => '5',
|
||||||
];
|
];
|
||||||
$this->assertEntity('user_2', $visibility, 'sidebar_second', 'bartik', -11, $settings);
|
$this->assertEntity('user_2', $visibility, 'sidebar', 'olivero', -11, $settings);
|
||||||
|
|
||||||
$visibility = [
|
$visibility = [
|
||||||
'user_role' => [
|
'user_role' => [
|
||||||
|
@ -167,7 +167,7 @@ class MigrateBlockTest extends MigrateDrupal6TestBase {
|
||||||
'label_display' => '0',
|
'label_display' => '0',
|
||||||
'items_per_page' => '10',
|
'items_per_page' => '10',
|
||||||
];
|
];
|
||||||
$this->assertEntity('user_3', $visibility, 'sidebar_second', 'bartik', -10, $settings);
|
$this->assertEntity('user_3', $visibility, 'sidebar', 'olivero', -10, $settings);
|
||||||
|
|
||||||
// Check system block.
|
// Check system block.
|
||||||
$visibility = [
|
$visibility = [
|
||||||
|
@ -183,7 +183,7 @@ class MigrateBlockTest extends MigrateDrupal6TestBase {
|
||||||
'provider' => 'system',
|
'provider' => 'system',
|
||||||
'label_display' => '0',
|
'label_display' => '0',
|
||||||
];
|
];
|
||||||
$this->assertEntity('system', $visibility, 'footer_fifth', 'bartik', -5, $settings);
|
$this->assertEntity('system', $visibility, 'footer_top', 'olivero', -5, $settings);
|
||||||
|
|
||||||
// Check menu blocks.
|
// Check menu blocks.
|
||||||
$settings = [
|
$settings = [
|
||||||
|
@ -192,7 +192,7 @@ class MigrateBlockTest extends MigrateDrupal6TestBase {
|
||||||
'provider' => 'core',
|
'provider' => 'core',
|
||||||
'label_display' => '0',
|
'label_display' => '0',
|
||||||
];
|
];
|
||||||
$this->assertEntity('menu', [], 'header', 'bartik', -5, $settings);
|
$this->assertEntity('menu', [], 'header', 'olivero', -5, $settings);
|
||||||
|
|
||||||
// Check aggregator block.
|
// Check aggregator block.
|
||||||
$settings = [
|
$settings = [
|
||||||
|
@ -203,7 +203,7 @@ class MigrateBlockTest extends MigrateDrupal6TestBase {
|
||||||
'block_count' => 7,
|
'block_count' => 7,
|
||||||
'feed' => '5',
|
'feed' => '5',
|
||||||
];
|
];
|
||||||
$this->assertEntity('aggregator', [], 'sidebar_second', 'bartik', -2, $settings);
|
$this->assertEntity('aggregator', [], 'sidebar', 'olivero', -2, $settings);
|
||||||
|
|
||||||
// Check book block.
|
// Check book block.
|
||||||
$settings = [
|
$settings = [
|
||||||
|
@ -213,7 +213,7 @@ class MigrateBlockTest extends MigrateDrupal6TestBase {
|
||||||
'label_display' => '0',
|
'label_display' => '0',
|
||||||
'block_mode' => 'book pages',
|
'block_mode' => 'book pages',
|
||||||
];
|
];
|
||||||
$this->assertEntity('book', [], 'sidebar_second', 'bartik', -4, $settings);
|
$this->assertEntity('book', [], 'sidebar', 'olivero', -4, $settings);
|
||||||
|
|
||||||
// Check forum block settings.
|
// Check forum block settings.
|
||||||
$settings = [
|
$settings = [
|
||||||
|
@ -226,7 +226,7 @@ class MigrateBlockTest extends MigrateDrupal6TestBase {
|
||||||
'administrative' => '1',
|
'administrative' => '1',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
$this->assertEntity('forum', [], 'sidebar_first', 'bartik', -8, $settings);
|
$this->assertEntity('forum', [], 'sidebar', 'olivero', -8, $settings);
|
||||||
|
|
||||||
$settings = [
|
$settings = [
|
||||||
'id' => 'forum_new_block',
|
'id' => 'forum_new_block',
|
||||||
|
@ -238,7 +238,7 @@ class MigrateBlockTest extends MigrateDrupal6TestBase {
|
||||||
'administrative' => '1',
|
'administrative' => '1',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
$this->assertEntity('forum_1', [], 'sidebar_first', 'bartik', -9, $settings);
|
$this->assertEntity('forum_1', [], 'sidebar', 'olivero', -9, $settings);
|
||||||
|
|
||||||
// Check statistic block settings.
|
// Check statistic block settings.
|
||||||
$settings = [
|
$settings = [
|
||||||
|
@ -250,7 +250,7 @@ class MigrateBlockTest extends MigrateDrupal6TestBase {
|
||||||
'top_all_num' => 8,
|
'top_all_num' => 8,
|
||||||
'top_last_num' => 9,
|
'top_last_num' => 9,
|
||||||
];
|
];
|
||||||
$this->assertEntity('statistics', [], 'sidebar_second', 'bartik', 0, $settings);
|
$this->assertEntity('statistics', [], 'sidebar', 'olivero', 0, $settings);
|
||||||
|
|
||||||
// Check custom blocks.
|
// Check custom blocks.
|
||||||
$visibility = [
|
$visibility = [
|
||||||
|
@ -269,7 +269,7 @@ class MigrateBlockTest extends MigrateDrupal6TestBase {
|
||||||
'info' => '',
|
'info' => '',
|
||||||
'view_mode' => 'full',
|
'view_mode' => 'full',
|
||||||
];
|
];
|
||||||
$this->assertEntity('block', $visibility, 'content', 'bartik', 0, $settings);
|
$this->assertEntity('block', $visibility, 'content', 'olivero', 0, $settings);
|
||||||
|
|
||||||
$visibility = [
|
$visibility = [
|
||||||
'request_path' => [
|
'request_path' => [
|
||||||
|
|
|
@ -36,15 +36,15 @@ class MigrateBlockTest extends MigrateDrupal7TestBase {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
// Install the themes used for this test.
|
// Install the themes used for this test.
|
||||||
$this->container->get('theme_installer')->install(['bartik', 'seven']);
|
|
||||||
|
|
||||||
$this->installEntitySchema('block_content');
|
$this->installEntitySchema('block_content');
|
||||||
|
$this->container->get('theme_installer')->install(['olivero', 'claro']);
|
||||||
|
|
||||||
$this->installConfig(static::$modules);
|
$this->installConfig(static::$modules);
|
||||||
|
|
||||||
// Set Bartik and Seven as the default public and admin theme.
|
// Set Olivero and Claro as the default public and admin theme.
|
||||||
$config = $this->config('system.theme');
|
$config = $this->config('system.theme');
|
||||||
$config->set('default', 'bartik');
|
$config->set('default', 'olivero');
|
||||||
$config->set('admin', 'seven');
|
$config->set('admin', 'claro');
|
||||||
$config->save();
|
$config->save();
|
||||||
|
|
||||||
$this->executeMigrations([
|
$this->executeMigrations([
|
||||||
|
@ -113,18 +113,18 @@ class MigrateBlockTest extends MigrateDrupal7TestBase {
|
||||||
* Tests the block migration.
|
* Tests the block migration.
|
||||||
*/
|
*/
|
||||||
public function testBlockMigration() {
|
public function testBlockMigration() {
|
||||||
$this->assertEntity('bartik_system_main', 'system_main_block', [], '', 'content', 'bartik', 0, '', '0');
|
$this->assertEntity('bartik_system_main', 'system_main_block', [], '', 'content', 'olivero', 0, '', '0');
|
||||||
$this->assertEntity('bartik_search_form', 'search_form_block', [], '', 'sidebar_first', 'bartik', -1, '', '0');
|
$this->assertEntity('bartik_search_form', 'search_form_block', [], '', 'content', 'olivero', -1, '', '0');
|
||||||
$this->assertEntity('bartik_user_login', 'user_login_block', [], '', 'sidebar_first', 'bartik', 0, 'User login title', 'visible');
|
$this->assertEntity('bartik_user_login', 'user_login_block', [], '', 'content', 'olivero', 0, 'User login title', 'visible');
|
||||||
$this->assertEntity('bartik_system_powered_by', 'system_powered_by_block', [], '', 'footer_fifth', 'bartik', 10, '', '0');
|
$this->assertEntity('bartik_system_powered_by', 'system_powered_by_block', [], '', 'footer_bottom', 'olivero', 10, '', '0');
|
||||||
$this->assertEntity('seven_system_main', 'system_main_block', [], '', 'content', 'seven', 0, '', '0');
|
$this->assertEntity('seven_system_main', 'system_main_block', [], '', 'content', 'claro', 0, '', '0');
|
||||||
$this->assertEntity('seven_user_login', 'user_login_block', [], '', 'content', 'seven', 10, 'User login title', 'visible');
|
$this->assertEntity('seven_user_login', 'user_login_block', [], '', 'content', 'claro', 10, 'User login title', 'visible');
|
||||||
|
|
||||||
// The d7_custom_block migration should have migrated a block containing a
|
// The d7_custom_block migration should have migrated a block containing a
|
||||||
// mildly amusing limerick. We'll need its UUID to determine
|
// mildly amusing limerick. We'll need its UUID to determine
|
||||||
// bartik_block_1's plugin ID.
|
// bartik_block_1's plugin ID.
|
||||||
$uuid = BlockContent::load(1)->uuid();
|
$uuid = BlockContent::load(1)->uuid();
|
||||||
$this->assertEntity('bartik_block_1', 'block_content:' . $uuid, ['authenticated'], '', 'highlighted', 'bartik', 0, 'Mildly amusing limerick of the day', 'visible');
|
$this->assertEntity('bartik_block_1', 'block_content:' . $uuid, ['authenticated'], '', 'content', 'olivero', 0, 'Mildly amusing limerick of the day', 'visible');
|
||||||
|
|
||||||
// Assert that disabled blocks (or enabled blocks whose plugin IDs could
|
// Assert that disabled blocks (or enabled blocks whose plugin IDs could
|
||||||
// be resolved) did not migrate.
|
// be resolved) did not migrate.
|
||||||
|
|
|
@ -10,7 +10,7 @@ source:
|
||||||
process:
|
process:
|
||||||
# Build the configuration name from the variable name, i.e.
|
# Build the configuration name from the variable name, i.e.
|
||||||
# theme_bartik_settings becomes bartik.settings.
|
# theme_bartik_settings becomes bartik.settings.
|
||||||
theme_name:
|
legacy_theme_name:
|
||||||
-
|
-
|
||||||
plugin: explode
|
plugin: explode
|
||||||
source: name
|
source: name
|
||||||
|
@ -19,6 +19,13 @@ process:
|
||||||
plugin: extract
|
plugin: extract
|
||||||
index:
|
index:
|
||||||
- 1
|
- 1
|
||||||
|
theme_name:
|
||||||
|
plugin: static_map
|
||||||
|
source: '@legacy_theme_name'
|
||||||
|
bypass: true
|
||||||
|
map:
|
||||||
|
bartik: olivero
|
||||||
|
seven: claro
|
||||||
configuration_name:
|
configuration_name:
|
||||||
plugin: concat
|
plugin: concat
|
||||||
source:
|
source:
|
||||||
|
|
|
@ -67,6 +67,7 @@ class ThemeSettings extends DestinationBase implements ContainerFactoryPluginInt
|
||||||
// Remove keys not in theme settings.
|
// Remove keys not in theme settings.
|
||||||
unset($theme_settings['configuration_name']);
|
unset($theme_settings['configuration_name']);
|
||||||
unset($theme_settings['theme_name']);
|
unset($theme_settings['theme_name']);
|
||||||
|
unset($theme_settings['legacy_theme_name']);
|
||||||
if (isset($theme_settings)) {
|
if (isset($theme_settings)) {
|
||||||
theme_settings_convert_to_config($theme_settings, $config);
|
theme_settings_convert_to_config($theme_settings, $config);
|
||||||
$config->save();
|
$config->save();
|
||||||
|
|
|
@ -17,8 +17,8 @@ class MigrateThemeSettingsTest extends MigrateDrupal7TestBase {
|
||||||
protected function setUp(): void {
|
protected function setUp(): void {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
// Install bartik and seven themes.
|
// Install Olivero and Claro themes.
|
||||||
\Drupal::service('theme_installer')->install(['bartik', 'seven']);
|
\Drupal::service('theme_installer')->install(['olivero', 'claro']);
|
||||||
$this->executeMigration('d7_theme_settings');
|
$this->executeMigration('d7_theme_settings');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ class MigrateThemeSettingsTest extends MigrateDrupal7TestBase {
|
||||||
* Tests migration of theme settings to variables to configuration.
|
* Tests migration of theme settings to variables to configuration.
|
||||||
*/
|
*/
|
||||||
public function testMigrateThemeSettings() {
|
public function testMigrateThemeSettings() {
|
||||||
$config = $this->config('bartik.settings');
|
$config = $this->config('olivero.settings');
|
||||||
|
|
||||||
$this->assertSame('', $config->get('favicon.path'));
|
$this->assertSame('', $config->get('favicon.path'));
|
||||||
$this->assertTrue($config->get('favicon.use_default'));
|
$this->assertTrue($config->get('favicon.use_default'));
|
||||||
|
@ -40,7 +40,7 @@ class MigrateThemeSettingsTest extends MigrateDrupal7TestBase {
|
||||||
$this->assertSame('public://gnu.png', $config->get('logo.path'));
|
$this->assertSame('public://gnu.png', $config->get('logo.path'));
|
||||||
$this->assertFalse($config->get('logo.use_default'));
|
$this->assertFalse($config->get('logo.use_default'));
|
||||||
|
|
||||||
$config = $this->config('seven.settings');
|
$config = $this->config('claro.settings');
|
||||||
$this->assertSame('', $config->get('favicon.path'));
|
$this->assertSame('', $config->get('favicon.path'));
|
||||||
$this->assertTrue($config->get('favicon.use_default'));
|
$this->assertTrue($config->get('favicon.use_default'));
|
||||||
$this->assertFalse($config->get('features.comment_user_picture'));
|
$this->assertFalse($config->get('features.comment_user_picture'));
|
||||||
|
|
Loading…
Reference in New Issue