You are here

protected function LibraryTypeKernelTestBase::getLibrary in Libraries API 8.3

Returns the test library for this library type.

Return value

\Drupal\libraries\ExternalLibrary\LibraryInterface The test library.

4 calls to LibraryTypeKernelTestBase::getLibrary()
AssetLibraryTest::testAttachableAssetInfo in tests/src/Kernel/ExternalLibrary/Asset/AssetLibraryTest.php
Tests that attachable asset library info is correctly gathered.
GlobalLocatorTest::testGlobalLocator in tests/src/Kernel/ExternalLibrary/GlobalLocatorTest.php
Tests that the library is located via the global loactor.
MultipleAssetLibraryTest::testAttachableAssetInfo in tests/src/Kernel/ExternalLibrary/Asset/MultipleAssetLibraryTest.php
Tests that attachable asset library info is correctly gathered.
PhpFileLibraryTest::testPhpFileInfo in tests/src/Kernel/ExternalLibrary/PhpFile/PhpFileLibraryTest.php
Tests that the list of PHP files is correctly gathered.

File

tests/src/Kernel/LibraryTypeKernelTestBase.php, line 153

Class

LibraryTypeKernelTestBase
Provides an improved version of the core kernel test base class.

Namespace

Drupal\Tests\libraries\Kernel

Code

protected function getLibrary() {
  try {
    $library = $this->libraryManager
      ->getLibrary($this
      ->getLibraryId());
  } catch (LibraryDefinitionNotFoundException $exception) {
    $library = $this
      ->prophesize(LibraryInterface::class)
      ->reveal();
  } catch (LibraryTypeNotFoundException $exception) {
    $library = $this
      ->prophesize(LibraryInterface::class)
      ->reveal();
  } catch (PluginException $exception) {
    $library = $this
      ->prophesize(LibraryInterface::class)
      ->reveal();
  } finally {
    return $library;
  }
}