function ResolvedLibraryDefinitionsFilesMatchTest::testCoreLibraryCompleteness
Same name and namespace in other branches
- 9 core/tests/Drupal/KernelTests/Core/Asset/ResolvedLibraryDefinitionsFilesMatchTest.php \Drupal\KernelTests\Core\Asset\ResolvedLibraryDefinitionsFilesMatchTest::testCoreLibraryCompleteness()
- 8.9.x core/tests/Drupal/KernelTests/Core/Asset/ResolvedLibraryDefinitionsFilesMatchTest.php \Drupal\KernelTests\Core\Asset\ResolvedLibraryDefinitionsFilesMatchTest::testCoreLibraryCompleteness()
- 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 115
Class
- ResolvedLibraryDefinitionsFilesMatchTest
- Tests that the asset files for all core libraries exist.
Namespace
Drupal\KernelTests\Core\AssetCode
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) {
// Filter contrib, hidden, already enabled modules and modules in the
// Testing package.
if ($module->origin !== 'core' || !empty($module->info['hidden']) || $module->status == TRUE || $module->info['package'] == 'Testing' || $module->info[ExtensionLifecycle::LIFECYCLE_IDENTIFIER] === ExtensionLifecycle::EXPERIMENTAL || $module->info[ExtensionLifecycle::LIFECYCLE_IDENTIFIER] === ExtensionLifecycle::DEPRECATED) {
return FALSE;
}
return TRUE;
});
// Install the 'user' entity schema because the workspaces module's install
// hook creates a workspace with default uid of 1. Then the layout_builder
// module's implementation of hook_entity_presave will cause
// \Drupal\Core\TypedData\Validation\RecursiveValidator::validate() to run
// on the workspace which will fail because the user table is not present.
// @todo Remove this in https://www.drupal.org/node/3039217.
$this->installEntitySchema('user');
// Install the 'path_alias' entity schema because the path alias path
// processor requires it.
$this->installEntitySchema('path_alias');
// Remove demo_umami_content module as its install hook creates content
// that relies on the presence of entity tables and various other elements
// not present in a kernel test.
unset($all_modules['demo_umami_content']);
$this->allModules = array_keys($all_modules);
$this->allModules[] = 'system';
$this->allModules[] = 'user';
$this->allModules[] = 'path_alias';
$database_module = \Drupal::database()->getProvider();
if ($database_module !== 'core') {
$this->allModules[] = $database_module;
}
sort($this->allModules);
$this->container
->get('module_installer')
->install($this->allModules);
// Get a library discovery from the new container.
$this->libraryDiscovery = $this->container
->get('library.discovery');
$this->assertLibraries();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.