You are here

public function ExtensionPathResolverTest::testUnknownExtension in Drupal 10

Tests the getPath() method with an unknown extension.

File

core/tests/Drupal/KernelTests/Core/Bootstrap/ExtensionPathResolverTest.php, line 97

Class

ExtensionPathResolverTest
Tests that extension path resolver works correctly.

Namespace

Drupal\KernelTests\Core\Bootstrap

Code

public function testUnknownExtension() {
  $module_extension_list = $this
    ->prophesize(ModuleExtensionList::class);
  $profile_extension_list = $this
    ->prophesize(ProfileExtensionList::class);
  $theme_extension_list = $this
    ->prophesize(ThemeExtensionList::class);
  $theme_engine_extension_list = $this
    ->prophesize(ThemeEngineExtensionList::class);
  $resolver = new ExtensionPathResolver($module_extension_list
    ->reveal(), $profile_extension_list
    ->reveal(), $theme_extension_list
    ->reveal(), $theme_engine_extension_list
    ->reveal());
  $this
    ->expectException(UnknownExtensionTypeException::class);
  $this
    ->expectExceptionMessage('Extension type foo is unknown.');
  $resolver
    ->getPath('foo', 'bar');
}