You are here

protected function LibraryDiscoveryIntegrationTest::assertNoAssetInLibrary in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Asset/LibraryDiscoveryIntegrationTest.php \Drupal\system\Tests\Asset\LibraryDiscoveryIntegrationTest::assertNoAssetInLibrary()

Asserts that the specified asset is not in the given library.

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.

mixed $sub_key: The library sub key where the given asset is defined.

string $message: (optional) A message to display with the assertion.

Return value

bool TRUE if the specified asset is not found in the library.

3 calls to LibraryDiscoveryIntegrationTest::assertNoAssetInLibrary()
LibraryDiscoveryIntegrationTest::testBaseThemeLibrariesOverrideInSubTheme in core/modules/system/src/Tests/Asset/LibraryDiscoveryIntegrationTest.php
Tests that base theme libraries-override still apply in sub themes.
LibraryDiscoveryIntegrationTest::testLibrariesExtend in core/modules/system/src/Tests/Asset/LibraryDiscoveryIntegrationTest.php
Tests libraries-extend.
LibraryDiscoveryIntegrationTest::testLibrariesOverride in core/modules/system/src/Tests/Asset/LibraryDiscoveryIntegrationTest.php
Tests that libraries-override are applied to library definitions.

File

core/modules/system/src/Tests/Asset/LibraryDiscoveryIntegrationTest.php, line 288
Contains \Drupal\system\Tests\Asset\LibraryDiscoveryIntegrationTest.

Class

LibraryDiscoveryIntegrationTest
Tests the library discovery and library discovery parser.

Namespace

Drupal\system\Tests\Asset

Code

protected function assertNoAssetInLibrary($asset, $extension, $library_name, $sub_key, $message = NULL) {
  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']) {
      return $this
        ->fail($message);
    }
  }
  return $this
    ->pass($message);
}