You are here

public function GlobalLocatorTest::testGlobalLocator in Libraries API 8.3

Tests that the library is located via the global loactor.

File

tests/src/Kernel/ExternalLibrary/GlobalLocatorTest.php, line 40

Class

GlobalLocatorTest
Tests that a global locator can be properly used to load a libraries.

Namespace

Drupal\Tests\libraries\Kernel\ExternalLibrary

Code

public function testGlobalLocator() {

  // By default the library will not be locatable (control assertion) until we
  // add the asset stream to the global loctors conf list.
  $library = $this
    ->getLibrary();
  $this
    ->assertFalse($library
    ->isInstalled());
  $config_factory = $this->container
    ->get('config.factory');
  $config_factory
    ->getEditable('libraries.settings')
    ->set('global_locators', [
    [
      'id' => 'uri',
      'configuration' => [
        'uri' => 'asset://',
      ],
    ],
  ])
    ->save();
  $library = $this
    ->getLibrary();
  $this
    ->assertTrue($library
    ->isInstalled());
}