diff --git a/core/lib/Drupal/Core/Asset/Exception/ExtensionDoesNotExistEception.php b/core/lib/Drupal/Core/Asset/Exception/ExtensionDoesNotExistException.php similarity index 65% rename from core/lib/Drupal/Core/Asset/Exception/ExtensionDoesNotExistEception.php rename to core/lib/Drupal/Core/Asset/Exception/ExtensionDoesNotExistException.php index cb5b25e..1537bf5 100644 --- a/core/lib/Drupal/Core/Asset/Exception/ExtensionDoesNotExistEception.php +++ b/core/lib/Drupal/Core/Asset/Exception/ExtensionDoesNotExistException.php @@ -3,7 +3,7 @@ namespace Drupal\Core\Asset\Exception; /** - * Defines a custom exception if a theme is not installed. + * Defines a custom exception if an extension is not installed. */ class ExtensionDoesNotExistException extends \RuntimeException { diff --git a/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php b/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php index 730a1e3..93e011e 100644 --- a/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php +++ b/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php @@ -97,7 +97,7 @@ public function buildByExtension($extension) { $extension_type = 'theme'; } else { - throw new ExtensionDoesNotExistException(sprintf("Theme extension '%s' could not be found because its extension '%s' is not installed", $extension)); + throw new ExtensionDoesNotExistException(sprintf("The extension '%s' is not installed.", $extension)); } $path = $this->drupalGetPath($extension_type, $extension); } diff --git a/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php b/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php index f2f8127..bd519ed 100644 --- a/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php +++ b/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php @@ -175,15 +175,22 @@ public function testInvalidLibrariesFile() { } /** - * Tests that an exception is thrown when a theme is not installed. + * Tests that an exception is thrown when the extension is not a valid + * module or theme. * - * @expectedException \InvalidArgumentException + * @expectedException \Drupal\Core\Asset\Exception\ExtensionDoesNotExistException * * @covers ::buildByExtension */ - public function testUnistalledTheme() { + public function testMissingExtension() { $this->moduleHandler->expects($this->atLeastOnce()) ->method('moduleExists') + ->with('uninstalled_theme') + ->will($this->returnValue(FALSE)); + + $this->themeHandler->expects($this->atLeastOnce()) + ->method('themeExists') + ->with('uninstalled_theme') ->will($this->returnValue(FALSE)); $this->libraryDiscoveryParser->buildByExtension('uninstalled_theme');