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

(cherry picked from commit d1860b9d68)
merge-requests/2638/head
catch 2022-08-17 17:41:46 +09:00
parent bdf69e7d49
commit 40c8434d08
3 changed files with 13 additions and 3 deletions

View File

@ -422,7 +422,7 @@ class ThemeTest extends BrowserTestBase {
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',
@ -430,6 +430,7 @@ class ThemeTest extends BrowserTestBase {
];
$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.

View File

@ -6,6 +6,7 @@ use Drupal\comment\Tests\CommentTestTrait;
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 @@ class EntityFilteringThemeTest extends BrowserTestBase {
// 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.

View File

@ -60,10 +60,9 @@ class ResolvedLibraryDefinitionsFilesMatchTest extends KernelTestBase {
* @var string[]
*/
protected $allThemes = [
'bartik',
'claro',
'classy',
'olivero',
'seven',
'stable',
'stark',
];