You are here

public function ResolvedLibraryDefinitionsFilesMatchTest::testCoreLibraryCompleteness in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/KernelTests/Core/Asset/ResolvedLibraryDefinitionsFilesMatchTest.php \Drupal\KernelTests\Core\Asset\ResolvedLibraryDefinitionsFilesMatchTest::testCoreLibraryCompleteness()
  2. 10 core/tests/Drupal/KernelTests/Core/Asset/ResolvedLibraryDefinitionsFilesMatchTest.php \Drupal\KernelTests\Core\Asset\ResolvedLibraryDefinitionsFilesMatchTest::testCoreLibraryCompleteness()

Ensures that all core module and theme library files exist.

File

core/tests/Drupal/KernelTests/Core/Asset/ResolvedLibraryDefinitionsFilesMatchTest.php, line 140

Class

ResolvedLibraryDefinitionsFilesMatchTest
Tests that the asset files for all core libraries exist.

Namespace

Drupal\KernelTests\Core\Asset

Code

public function testCoreLibraryCompleteness() {

  // First verify all libraries with no active theme.
  $this
    ->verifyLibraryFilesExist($this
    ->getAllLibraries());

  // Then verify all libraries for each core theme. This may seem like
  // overkill but themes can override and extend other extensions' libraries
  // and these changes are only applied for the active theme.
  foreach ($this->allThemes as $theme) {
    $this->themeManager
      ->setActiveTheme($this->themeInitialization
      ->getActiveThemeByName($theme));
    $this->libraryDiscovery
      ->clearCachedDefinitions();
    $this
      ->verifyLibraryFilesExist($this
      ->getAllLibraries());
  }
}