Commit fefc4b6c authored by Zoltan Attila Horvath's avatar Zoltan Attila Horvath Committed by Zoltan Attila Horvath
Browse files

Issue #3300629 by huzooka: Handle different (new) default themes in Drupal core 9.5+

parent 7c05ea36
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -86,13 +86,16 @@ class MigMagKernelTestDxTraitTest extends MigrateDrupalTestBase {
      : $this->container->get('site.path');
    $this->setSetting('file_private_path', $site_path . '/private');

    // Install Bartik and Seven.
    // Install default and default admin themes.
    [$default_theme, $admin_theme] = static::claroAndOliveroAreDefaultThemes()
      ? ['olivero', 'claro']
      : ['bartik', 'seven'];
    $theme_installer = \Drupal::service('theme_installer');
    assert($theme_installer instanceof ThemeInstallerInterface);
    $theme_installer->install(['bartik', 'seven']);
    $theme_installer->install([$default_theme, $admin_theme]);
    $this->config('system.theme')
      ->set('default', 'bartik')
      ->set('admin', 'seven')
      ->set('default', $default_theme)
      ->set('admin', $admin_theme)
      ->save();

    // We have to create at least an anonymous user.
+10 −0
Original line number Diff line number Diff line
@@ -17,4 +17,14 @@ trait CoreCompatibilityTrait {
    return version_compare(\Drupal::VERSION, '9.4.0-dev', 'ge');
  }

  /**
   * Whether Claro and Olivero are the default (and default admin) themes.
   *
   * @return bool
   *   Whether Claro and Olivero are the default (and default admin) themes.
   */
  protected static function claroAndOliveroAreDefaultThemes(): bool {
    return version_compare(\Drupal::VERSION, '9.5.0-dev', 'ge');
  }

}