function LibraryDiscoveryIntegrationTest::assertAssetInLibrary
Same name in other branches
- 9 core/tests/Drupal/KernelTests/Core/Asset/LibraryDiscoveryIntegrationTest.php \Drupal\KernelTests\Core\Asset\LibraryDiscoveryIntegrationTest::assertAssetInLibrary()
- 8.9.x core/tests/Drupal/KernelTests/Core/Asset/LibraryDiscoveryIntegrationTest.php \Drupal\KernelTests\Core\Asset\LibraryDiscoveryIntegrationTest::assertAssetInLibrary()
- 10 core/tests/Drupal/KernelTests/Core/Asset/LibraryDiscoveryIntegrationTest.php \Drupal\KernelTests\Core\Asset\LibraryDiscoveryIntegrationTest::assertAssetInLibrary()
Asserts that the specified asset is in the given library.
@internal
Parameters
string $asset: The asset file with the path for the file.
string $extension: The extension in which the $library is defined.
string $library_name: Name of the library.
string $sub_key: The library sub key where the given asset is defined.
string $message: (optional) A message to display with the assertion.
4 calls to LibraryDiscoveryIntegrationTest::assertAssetInLibrary()
- LibraryDiscoveryIntegrationTest::testBaseThemeLibrariesOverrideInSubTheme in core/
tests/ Drupal/ KernelTests/ Core/ Asset/ LibraryDiscoveryIntegrationTest.php - Tests that base theme libraries-override still apply in sub themes.
- LibraryDiscoveryIntegrationTest::testLibrariesExtend in core/
tests/ Drupal/ KernelTests/ Core/ Asset/ LibraryDiscoveryIntegrationTest.php - Tests libraries-extend.
- LibraryDiscoveryIntegrationTest::testLibrariesOverride in core/
tests/ Drupal/ KernelTests/ Core/ Asset/ LibraryDiscoveryIntegrationTest.php - Tests that libraries-override are applied to library definitions.
- LibraryDiscoveryIntegrationTest::testLibrariesOverrideOtherAssetLibraryNames in core/
tests/ Drupal/ KernelTests/ Core/ Asset/ LibraryDiscoveryIntegrationTest.php - Tests library assets with other ways for specifying paths.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Asset/ LibraryDiscoveryIntegrationTest.php, line 309
Class
- LibraryDiscoveryIntegrationTest
- Tests the library discovery and library discovery parser.
Namespace
Drupal\KernelTests\Core\AssetCode
protected function assertAssetInLibrary(string $asset, string $extension, string $library_name, string $sub_key, ?string $message = NULL) : void {
if (!isset($message)) {
$message = sprintf('Asset %s found in library "%s/%s"', $asset, $extension, $library_name);
}
$library = $this->libraryDiscovery
->getLibraryByName($extension, $library_name);
foreach ($library[$sub_key] as $definition) {
if ($asset == $definition['data']) {
return;
}
}
$this->fail($message);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.