function LibraryDiscoveryIntegrationTest::testLibrariesOverrideMalformedAsset
Same name in other branches
- 9 core/tests/Drupal/KernelTests/Core/Asset/LibraryDiscoveryIntegrationTest.php \Drupal\KernelTests\Core\Asset\LibraryDiscoveryIntegrationTest::testLibrariesOverrideMalformedAsset()
- 10 core/tests/Drupal/KernelTests/Core/Asset/LibraryDiscoveryIntegrationTest.php \Drupal\KernelTests\Core\Asset\LibraryDiscoveryIntegrationTest::testLibrariesOverrideMalformedAsset()
- 11.x core/tests/Drupal/KernelTests/Core/Asset/LibraryDiscoveryIntegrationTest.php \Drupal\KernelTests\Core\Asset\LibraryDiscoveryIntegrationTest::testLibrariesOverrideMalformedAsset()
Tests libraries-override on malformed assets.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Asset/ LibraryDiscoveryIntegrationTest.php, line 114
Class
- LibraryDiscoveryIntegrationTest
- Tests the library discovery and library discovery parser.
Namespace
Drupal\KernelTests\Core\AssetCode
public function testLibrariesOverrideMalformedAsset() {
// Activate test theme that overrides with a malformed asset.
$this->activateTheme('test_theme_libraries_override_with_invalid_asset');
// Assert that improperly formed asset "specs" throw an exception.
try {
$this->libraryDiscovery
->getLibraryByName('core', 'drupal.dialog');
$this->fail('Throw Exception when specifying invalid override');
} catch (InvalidLibrariesOverrideSpecificationException $e) {
$expected_message = 'Library asset core/drupal.dialog/css is not correctly specified. It should be in the form "extension/library_name/sub_key/path/to/asset.js".';
$this->assertEqual($e->getMessage(), $expected_message, 'Throw Exception when specifying invalid override');
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.