Commit e5881439 authored by catch's avatar catch
Browse files

Issue #3302800 by nod_, quietone, longwave: Core tests need to filter out...

Issue #3302800 by nod_, quietone, longwave: Core tests need to filter out deprecated themes when looping over all themes

(cherry picked from commit d1860b9d)
parent 4cc760e1
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -423,7 +423,7 @@ public function testInvalidTheme() {
  public function testUninstallingThemes() {
    // Install olivero.
    \Drupal::service('theme_installer')->install(['olivero']);
    // Set up claro as the admin theme.
    // Set up Claro as the admin theme.
    \Drupal::service('theme_installer')->install(['claro']);
    $edit = [
      'admin_theme' => 'claro',
@@ -431,6 +431,7 @@ public function testUninstallingThemes() {
    ];
    $this->drupalGet('admin/appearance');
    $this->submitForm($edit, 'Save configuration');

    // Set olivero as the default theme.
    $this->cssSelect('a[title="Set Olivero as default theme"]')[0]->click();
    // Check that claro cannot be uninstalled as it is the admin theme.
+10 −0
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@
use Drupal\Core\Extension\ExtensionDiscovery;
use Drupal\comment\CommentInterface;
use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
use Drupal\Core\Extension\ExtensionLifecycle;
use Drupal\node\NodeInterface;
use Drupal\comment\Entity\Comment;
use Drupal\taxonomy\Entity\Term;
@@ -87,6 +88,15 @@ protected function setUp(): void {
    // Install all available non-testing themes.
    $listing = new ExtensionDiscovery(\Drupal::root());
    $this->themes = $listing->scan('theme', FALSE);
    /** @var \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler */
    $theme_data = \Drupal::service('theme_handler')->rebuildThemeData();
    foreach (array_keys($this->themes) as $theme) {
      // Skip obsolete and deprecated themes.
      $info = $theme_data[$theme]->info;
      if ($info[ExtensionLifecycle::LIFECYCLE_IDENTIFIER] === ExtensionLifecycle::OBSOLETE || $info[ExtensionLifecycle::LIFECYCLE_IDENTIFIER] === ExtensionLifecycle::DEPRECATED) {
        unset($this->themes[$theme]);
      }
    }
    \Drupal::service('theme_installer')->install(array_keys($this->themes));

    // Create a test user.
+1 −2
Original line number Diff line number Diff line
@@ -60,10 +60,9 @@ class ResolvedLibraryDefinitionsFilesMatchTest extends KernelTestBase {
   * @var string[]
   */
  protected $allThemes = [
    'bartik',
    'claro',
    'classy',
    'olivero',
    'seven',
    'stable',
    'stark',
  ];