From b06f36046fd9cae6f4391d51d79f7199fdbe96bb Mon Sep 17 00:00:00 2001 From: quietone <quietone@2572884.no-reply.drupal.org> Date: Sat, 19 Apr 2025 18:49:38 +1200 Subject: [PATCH] add new method --- ...solvedLibraryDefinitionsFilesMatchTest.php | 45 +++++++++++++++---- 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/core/tests/Drupal/KernelTests/Core/Asset/ResolvedLibraryDefinitionsFilesMatchTest.php b/core/tests/Drupal/KernelTests/Core/Asset/ResolvedLibraryDefinitionsFilesMatchTest.php index 340dcc286494..43ae494680dd 100644 --- a/core/tests/Drupal/KernelTests/Core/Asset/ResolvedLibraryDefinitionsFilesMatchTest.php +++ b/core/tests/Drupal/KernelTests/Core/Asset/ResolvedLibraryDefinitionsFilesMatchTest.php @@ -99,6 +99,20 @@ class ResolvedLibraryDefinitionsFilesMatchTest extends KernelTestBase { protected function setUp(): void { parent::setUp(); + // Install all core themes. + sort($this->allThemes); + $this->container->get('theme_installer')->install($this->allThemes); + + $this->themeHandler = $this->container->get('theme_handler'); + $this->themeInitialization = $this->container->get('theme.initialization'); + $this->themeManager = $this->container->get('theme.manager'); + $this->libraryDiscovery = $this->container->get('library.discovery'); + } + + /** + * Ensures that all core module and theme library files exist. + */ + public function testCoreLibraryCompleteness(): void { // Enable all core modules. $all_modules = $this->container->get('extension.list.module')->getList(); $all_modules = array_filter($all_modules, function ($module) { @@ -142,20 +156,33 @@ protected function setUp(): void { sort($this->allModules); $this->container->get('module_installer')->install($this->allModules); - // Install all core themes. - sort($this->allThemes); - $this->container->get('theme_installer')->install($this->allThemes); + $this->assertLibraries(); + } - $this->themeHandler = $this->container->get('theme_handler'); - $this->themeInitialization = $this->container->get('theme.initialization'); - $this->themeManager = $this->container->get('theme.manager'); - $this->libraryDiscovery = $this->container->get('library.discovery'); + /** + * Ensures that module and theme library files exist for a deprecated modules. + * + * @group legacy + */ + public function testCoreLibraryCompletenessDeprecated(): void { + // Find and install deprecated modules to test. + $all_modules = $this->container->get('extension.list.module')->getList(); + $deprecated_modules_to_test = array_filter($all_modules, function ($module) { + if ($module->origin == 'core' + && $module->info[ExtensionLifecycle::LIFECYCLE_IDENTIFIER] === ExtensionLifecycle::DEPRECATED) { + return TRUE; + } + }); + $this->container->get('module_installer')->install(array_keys($deprecated_modules_to_test)); + $this->allModules = array_keys(\Drupal::moduleHandler()->getModuleList()); + + $this->assertLibraries(); } /** - * Ensures that all core module and theme library files exist. + * Asserts the libraries for modules and themes exist. */ - public function testCoreLibraryCompleteness(): void { + public function assertLibraries(): void { // First verify all libraries with no active theme. $this->verifyLibraryFilesExist($this->getAllLibraries()); -- GitLab