You are here

protected function LibraryDiscoveryIntegrationTest::assertNoAssetInLibrary in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/KernelTests/Core/Asset/LibraryDiscoveryIntegrationTest.php \Drupal\KernelTests\Core\Asset\LibraryDiscoveryIntegrationTest::assertNoAssetInLibrary()
  2. 9 core/tests/Drupal/KernelTests/Core/Asset/LibraryDiscoveryIntegrationTest.php \Drupal\KernelTests\Core\Asset\LibraryDiscoveryIntegrationTest::assertNoAssetInLibrary()

Asserts that the specified asset is not 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_name 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.

3 calls to LibraryDiscoveryIntegrationTest::assertNoAssetInLibrary()
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.

File

core/tests/Drupal/KernelTests/Core/Asset/LibraryDiscoveryIntegrationTest.php, line 301

Class

LibraryDiscoveryIntegrationTest
Tests the library discovery and library discovery parser.

Namespace

Drupal\KernelTests\Core\Asset

Code

protected function assertNoAssetInLibrary(string $asset, string $extension, string $library_name, string $sub_key, string $message = NULL) : void {
  if (!isset($message)) {
    $message = sprintf('Asset %s not 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']) {
      $this
        ->fail($message);
    }
  }
}