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