diff -u b/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php b/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php --- b/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php +++ b/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php @@ -350,7 +350,7 @@ // Active theme defines an override for an asset within this library. // Throw an exception if the asset is not properly specified. if (substr_count($asset, '/') < 3) { - throw new \LogicException(SafeMarkup::format('Library asset %asset is not correctly specified. It should be in the form "extension/library_name/sub_key/path/to/asset.js".', ['%asset' => $asset])); + throw new \LogicException(sprintf('Library asset %s is not correctly specified. It should be in the form "extension/library_name/sub_key/path/to/asset.js".', $asset)); } list(, , $sub_key, $value) = explode('/', $asset, 4); if ($sub_key === 'drupalSettings') { diff -u b/core/modules/system/src/Tests/Asset/LibraryDiscoveryIntegrationTest.php b/core/modules/system/src/Tests/Asset/LibraryDiscoveryIntegrationTest.php --- b/core/modules/system/src/Tests/Asset/LibraryDiscoveryIntegrationTest.php +++ b/core/modules/system/src/Tests/Asset/LibraryDiscoveryIntegrationTest.php @@ -140,30 +140,56 @@ } } + /** + * Asserts that the given asset is in library. + * + * @param mixed[] $library_item + * The library where given asset should be. + * @param string $library_name + * Name of the library. + * @param string $asset + * The asset file with the path for the file. + * @param string $message + * (optional) A message to display with the assertion. + * + * @return bool + */ protected function assertAssetInLibrary($library_item, $library_name, $asset, $message = NULL) { if (!isset($message)) { $message = SafeMarkup::format('Asset @asset found in library @library', ['@asset' => $asset, '@library' => $library_name]); } foreach ($library_item as $definition) { if ($asset == $definition['data']) { - $this->pass($message); - return; + return($this->pass($message)); } } - $this->fail($message); + return($this->fail($message)); } + /** + * Asserts that the given asset is not in library. + * + * @param mixed[] $library_item + * The library where given asset should not be. + * @param string $library_name + * Name of the library. + * @param string $asset + * The asset file with the path for the file. + * @param string $message + * (optional) A message to display with the assertion. + * + * @return bool + */ protected function assertNoAssetInLibrary($library_item, $library_name, $asset, $message = NULL) { if (!isset($message)) { $message = SafeMarkup::format('Asset @asset not found in library @library', ['@asset' => $asset, '@library' => $library_name]); } foreach ($library_item as $definition) { if ($asset == $definition['data']) { - $this->fail($message); - return; + return($this->fail($message)); } } - $this->pass($message); + return($this->pass($message)); } } diff -u b/core/modules/system/tests/themes/test_theme/test_theme.info.yml b/core/modules/system/tests/themes/test_theme/test_theme.info.yml --- b/core/modules/system/tests/themes/test_theme/test_theme.info.yml +++ b/core/modules/system/tests/themes/test_theme/test_theme.info.yml @@ -14,6 +14,8 @@ version: VERSION base theme: classy core: 8.x +-stylesheets-remove: + - '@system/css/system.theme.css' libraries-override: system/base/css/component/css/system.module.css: false # Replace an entire library. only in patch2: unchanged: --- a/core/modules/system/src/Tests/Theme/ThemeTest.php +++ b/core/modules/system/src/Tests/Theme/ThemeTest.php @@ -167,7 +167,8 @@ function testCSSOverride() { $config->set('css.preprocess', 0); $config->save(); $this->drupalGet('theme-test/suggestion'); - $this->assertNoText('system.module.css', 'The theme\'s .info.yml file is able to override a module CSS file from being added to the page.'); + $this->assertNoText('system.module.css', "The theme's .info.yml file is able to remove a module CSS file from being added to the page using libraries-override."); + $this->assertNoText('system.theme.css', "The theme's .info.yml file is able to remove a module CSS file from being added to the pagei using stylesheets-remove."); // Also test with aggregation enabled, simply ensuring no PHP errors are // triggered during drupal_build_css_cache() when a source file doesn't