public function LibraryDiscoveryIntegrationTest::testLibrariesOverrideMalformedAsset in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/src/Tests/Asset/LibraryDiscoveryIntegrationTest.php \Drupal\system\Tests\Asset\LibraryDiscoveryIntegrationTest::testLibrariesOverrideMalformedAsset()
Tests libraries-override on malformed assets.
File
- core/
modules/ system/ src/ Tests/ Asset/ LibraryDiscoveryIntegrationTest.php, line 119 - Contains \Drupal\system\Tests\Asset\LibraryDiscoveryIntegrationTest.
Class
- LibraryDiscoveryIntegrationTest
- Tests the library discovery and library discovery parser.
Namespace
Drupal\system\Tests\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');
}
}