function LibraryDiscoveryParserTest::testExternalLibraries
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php \Drupal\Tests\Core\Asset\LibraryDiscoveryParserTest::testExternalLibraries()
- 10 core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php \Drupal\Tests\Core\Asset\LibraryDiscoveryParserTest::testExternalLibraries()
- 11.x core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php \Drupal\Tests\Core\Asset\LibraryDiscoveryParserTest::testExternalLibraries()
Tests that the version property of external libraries is handled.
@covers ::buildByExtension
File
-
core/
tests/ Drupal/ Tests/ Core/ Asset/ LibraryDiscoveryParserTest.php, line 257
Class
- LibraryDiscoveryParserTest
- @coversDefaultClass \Drupal\Core\Asset\LibraryDiscoveryParser @group Asset
Namespace
Drupal\Tests\Core\AssetCode
public function testExternalLibraries() {
$this->moduleHandler
->expects($this->atLeastOnce())
->method('moduleExists')
->with('external')
->will($this->returnValue(TRUE));
$path = __DIR__ . '/library_test_files';
$path = substr($path, strlen($this->root) + 1);
$this->libraryDiscoveryParser
->setPaths('module', 'external', $path);
$libraries = $this->libraryDiscoveryParser
->buildByExtension('external');
$library = $libraries['example_external'];
$this->assertEquals('http://example.com/css/example_external.css', $library['css'][0]['data']);
$this->assertEquals('http://example.com/example_external.js', $library['js'][0]['data']);
$this->assertEquals('3.14', $library['version']);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.