X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fmodules%2Fcontrib%2Flibraries%2Ftests%2Fsrc%2FKernel%2FExternalLibrary%2FGlobalLocatorTest.php;fp=web%2Fmodules%2Fcontrib%2Flibraries%2Ftests%2Fsrc%2FKernel%2FExternalLibrary%2FGlobalLocatorTest.php;h=84eb86eb1e532f06e8ded013c6f9b6da93587d34;hp=0000000000000000000000000000000000000000;hb=8acec36f19c470dfcda1ae2336826a782f41874c;hpb=e0411c4e83ba0d079034db83c3f7f55be24a0e35 diff --git a/web/modules/contrib/libraries/tests/src/Kernel/ExternalLibrary/GlobalLocatorTest.php b/web/modules/contrib/libraries/tests/src/Kernel/ExternalLibrary/GlobalLocatorTest.php new file mode 100644 index 000000000..84eb86eb1 --- /dev/null +++ b/web/modules/contrib/libraries/tests/src/Kernel/ExternalLibrary/GlobalLocatorTest.php @@ -0,0 +1,53 @@ +container->set('stream_wrapper.asset_libraries', new TestLibraryFilesStream( + $this->container->get('module_handler'), + $this->container->get('string_translation'), + 'libraries' + )); + } + + /** + * {@inheritdoc} + */ + protected function getLibraryTypeId() { + return 'php_file'; + } + + /** + * Tests that the library is located via the global loactor. + */ + 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()); + } + +}