Commit f779b148 authored by catch's avatar catch
Browse files

Issue #3309176 by lauriii, bbrala, Spokje, quietone, bnjmnm: Remove Stable theme from Drupal 10

(cherry picked from commit a5893cba)
parent 8a0273ab
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -8,7 +8,5 @@ modules/layout_builder/css/**/*.css
!modules/layout_builder/css/**/*.pcss.css
modules/workspaces/css/**/*.css
!modules/workspaces/css/**/*.pcss.css
themes/stable/css/core/dialog/off-canvas.reset.css
themes/stable/css/core/dialog/off-canvas.base.css
themes/stable9/css/core/dialog/off-canvas.reset.css
themes/stable9/css/core/dialog/off-canvas.base.css
+0 −1
Original line number Diff line number Diff line
@@ -477,7 +477,6 @@
  "ignoreFiles": [
    "assets/vendor/**/*.css",
    "tests/Drupal/Tests/Core/Asset/css_test_files/**/*.css",
    "themes/stable/css/core/assets/vendor/**/*.css",
    "themes/stable9/css/core/assets/vendor/**/*.css"
  ]
}
+0 −3
Original line number Diff line number Diff line
@@ -372,9 +372,6 @@ Shortcut
- Tobias Zimmermann 'tstoeckler' https://www.drupal.org/u/tstoeckler
- Jibran Ijaz 'jibran' https://www.drupal.org/u/jibran

Stable
- ?

Stark
- John Albin Wilkins 'JohnAlbin' https://www.drupal.org/u/johnalbin

+1 −1
Original line number Diff line number Diff line
@@ -225,7 +225,7 @@
                  // place, the 'next' button is focused here.
                  nextButton.focus();

                  // When Stable or Stable 9 are part of the active theme, the
                  // When Stable 9 is part of the active theme, the
                  // Drupal.tour.convertToJoyrideMarkup() function is available.
                  // This function converts Shepherd markup to Joyride markup,
                  // facilitating the use of the Shepherd library that is
+0 −122
Original line number Diff line number Diff line
<?php

namespace Drupal\KernelTests\Core\Theme;

/**
 * Tests Stable's library overrides.
 *
 * @group Theme
 * @group legacy
 */
class StableLibraryOverrideTest extends StableLibraryOverrideTestBase {

  /**
   * The theme manager.
   *
   * @var \Drupal\Core\Theme\ThemeManagerInterface
   */
  protected $themeManager;

  /**
   * The theme initialization.
   *
   * @var \Drupal\Core\Theme\ThemeInitializationInterface
   */
  protected $themeInitialization;

  /**
   * The library discovery service.
   *
   * @var \Drupal\Core\Asset\LibraryDiscoveryInterface
   */
  protected $libraryDiscovery;

  /**
   * A list of all core modules.
   *
   * @var string[]
   */
  protected $allModules;

  /**
   * A list of libraries to skip checking, in the format extension/library_name.
   *
   * @var string[]
   */
  protected $librariesToSkip = [
    'core/drupal.dialog.off_canvas',
    'layout_builder/drupal.layout_builder',
    'views/views.responsive-grid',
  ];

  /**
   * {@inheritdoc}
   */
  protected static $modules = ['system', 'user', 'path_alias'];

  /**
   * {@inheritdoc}
   */
  protected function setUp(): void {
    parent::setUp();

    $this->container->get('theme_installer')->install(['stable']);

    // Enable all core modules.
    $this->enableVisibleAndStableCoreModules();

    $this->themeManager = $this->container->get('theme.manager');
    $this->themeInitialization = $this->container->get('theme.initialization');
    $this->libraryDiscovery = $this->container->get('library.discovery');
  }

  /**
   * Ensures that Stable overrides all relevant core library assets.
   */
  public function testStableLibraryOverrides() {
    // First get the clean library definitions with no active theme.
    $libraries_before = $this->getAllLibraries();
    $libraries_before = $this->removeVendorAssets($libraries_before);

    $this->themeManager->setActiveTheme($this->themeInitialization->getActiveThemeByName('stable'));
    $this->libraryDiscovery->clearCachedDefinitions();

    // Now get the library definitions with Stable as the active theme.
    $libraries_after = $this->getAllLibraries();
    $libraries_after = $this->removeVendorAssets($libraries_after);

    foreach ($libraries_before as $extension => $libraries) {
      foreach ($libraries as $library_name => $library) {
        // Allow skipping libraries.
        if (in_array("$extension/$library_name", $this->librariesToSkip)) {
          continue;
        }
        // Skip internal libraries.
        if (substr($library_name, 0, 9) === 'internal.') {
          continue;
        }
        $library_after = $libraries_after[$extension][$library_name];

        // Check that all the CSS assets are overridden.
        foreach ($library['css'] as $index => $asset) {
          $clean_path = $asset['data'];
          $stable_path = $library_after['css'][$index]['data'];
          // Make core/misc assets look like they are coming from a "core"
          // module.
          $replacements = [
            'core/misc/' => "core/modules/core/css/",
          ];
          $expected_path = strtr($clean_path, $replacements);

          // Adjust the module asset paths to correspond with the Stable folder
          // structure.
          $expected_path = str_replace("core/modules/$extension/css/", "core/themes/stable/css/$extension/", $expected_path);
          $assert_path = str_replace("core/modules/$extension/", '', $clean_path);

          $this->assertEquals($expected_path, $stable_path, "$assert_path from the $extension/$library_name library is overridden in Stable.");
        }
      }
    }
  }

}
Loading