Verified Commit 914fadac authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3263935 by huzooka, danflanagan8, quietone: system_site migrates...

Issue #3263935 by huzooka, danflanagan8, quietone: system_site migrates default 403, 404 and front page paths as forward slash (/)
parent 9117ebf1
Loading
Loading
Loading
Loading
+39 −13
Original line number Diff line number Diff line
@@ -23,21 +23,47 @@ process:
  mail: site_mail
  slogan: site_slogan
  'page/front':
    -
      plugin: concat
      source:
        - constants/slash
        - site_frontpage
    -
      plugin: static_map
      map:
        # Drupal 6 and Drupal 7 default site_frontpage is 'node'. If this
        # variable is set to 'node', to an empty string, or it is completely
        # missing, we want to migrate the equivalent Drupal 9 value, which is
        # '/node'.
        '/': '/node'
      bypass: true
  'page/403':
    -
      plugin: concat
      source:
        - constants/slash
        - site_403
    -
      plugin: static_map
      map:
        '/': ''
      bypass: true
  'page/404':
    -
      plugin: concat
      source:
        - constants/slash
        - site_404
  weight_select_max: drupal_weight_select_max
    -
      plugin: static_map
      map:
        '/': ''
      bypass: true
  weight_select_max:
    plugin: default_value
    source: drupal_weight_select_max
    strict: true
    default_value: 100
  admin_compact_mode: admin_compact_mode
destination:
  plugin: config
+7 −1
Original line number Diff line number Diff line
@@ -120,6 +120,12 @@ class MigrateSystemConfigurationTest extends MigrateDrupal6TestBase {
  protected function setUp(): void {
    parent::setUp();

    // Delete 'site_frontpage' in order to test the migration of a non-existing
    // front page link.
    $this->sourceDatabase->delete('variable')
      ->condition('name', 'site_frontpage')
      ->execute();

    $migrations = [
      'd6_system_cron',
      'd6_system_date',
@@ -142,7 +148,7 @@ public function testConfigurationMigration() {
    foreach ($this->expectedConfig as $config_id => $values) {
      $actual = \Drupal::config($config_id)->get();
      unset($actual['_core']);
      $this->assertSame($actual, $values, $config_id . ' matches expected values.');
      $this->assertSame($values, $actual, $config_id . ' matches expected values.');
    }
  }

+18 −3
Original line number Diff line number Diff line
@@ -105,12 +105,12 @@ class MigrateSystemConfigurationTest extends MigrateDrupal7TestBase {
      'mail' => 'joseph@flattandsons.com',
      'slogan' => 'The Slogan',
      'page' => [
        '403' => '/node',
        '403' => '',
        '404' => '/node',
        'front' => '/node',
      ],
      'admin_compact_mode' => TRUE,
      'weight_select_max' => 40,
      'weight_select_max' => 100,
      'default_langcode' => 'en',
    ],
  ];
@@ -133,6 +133,21 @@ protected function setUp(): void {
      ])
      ->execute();

    // Delete 'site_403' in order to test the migration of a non-existing error
    // page link.
    $this->sourceDatabase->delete('variable')
      ->condition('name', 'site_403')
      ->execute();
    // Delete 'drupal_weight_select_max ' in order to test the migration when it
    // is not set.
    $this->sourceDatabase->delete('variable')
      ->condition('name', 'drupal_weight_select_max')
      ->execute();

    $this->config('system.site')
      ->set('weight_select_max', 5)
      ->save();

    $migrations = [
      'd7_system_authorize',
      'd7_system_cron',
@@ -162,7 +177,7 @@ public function testConfigurationMigration() {
        $actual = \Drupal::config($config_id)->get();
      }
      unset($actual['_core']);
      $this->assertSame($actual, $values, $config_id . ' matches expected values.');
      $this->assertSame($values, $actual, $config_id . ' matches expected values.');
    }
    // The d7_system_authorize migration should not create the system.authorize
    // config.