Commit ddf7d7c6 authored by catch's avatar catch
Browse files

Issue #3281427 by quietone, nod_, deviantintegral, Spokje: Update Block and...

Issue #3281427 by quietone, nod_, deviantintegral, Spokje: Update Block and Theme setting migrations to not use Bartik and Seven

(cherry picked from commit 5b23a5ea)
parent c4fad467
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -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
+23 −11
Original line number Diff line number Diff line
@@ -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
+17 −17
Original line number Diff line number Diff line
@@ -36,14 +36,14 @@ protected function setUp(): void {
    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 @@ public function assertEntity(string $id, array $visibility, string $region, stri
   */
  public function testBlockMigration() {
    $blocks = Block::loadMultiple();
    $this->assertCount(14, $blocks);
    $this->assertCount(25, $blocks);

    // Check user blocks.
    $visibility = [
@@ -113,7 +113,7 @@ public function testBlockMigration() {
      '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 @@ public function testBlockMigration() {
      '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 @@ public function testBlockMigration() {
      '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 @@ public function testBlockMigration() {
      '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 @@ public function testBlockMigration() {
      '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 @@ public function testBlockMigration() {
      '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 @@ public function testBlockMigration() {
      '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 @@ public function testBlockMigration() {
      '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 @@ public function testBlockMigration() {
        '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 @@ public function testBlockMigration() {
        '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 @@ public function testBlockMigration() {
      '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 @@ public function testBlockMigration() {
      'info' => '',
      'view_mode' => 'full',
    ];
    $this->assertEntity('block', $visibility, 'content', 'bartik', 0, $settings);
    $this->assertEntity('block', $visibility, 'content', 'olivero', 0, $settings);

    $visibility = [
      'request_path' => [
+12 −12
Original line number Diff line number Diff line
@@ -36,15 +36,15 @@ protected function setUp(): void {
    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 @@ public function assertEntity(string $id, string $plugin_id, array $roles, string
   * 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.
+8 −1
Original line number Diff line number Diff line
@@ -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:
Loading