You are here

public function ExtensionPathResolverTest::testExtensionPathResolving in Drupal 9

@covers ::getPathname

File

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

Class

ExtensionPathResolverTest
Tests that extension path resolver works correctly.

Namespace

Drupal\KernelTests\Core\Bootstrap

Code

public function testExtensionPathResolving() : void {

  // Retrieving the location of a module.
  $this
    ->assertSame('core/modules/system/system.info.yml', \Drupal::service('extension.list.module')
    ->getPathname('system'));

  // Retrieving the location of a theme.
  \Drupal::service('theme_installer')
    ->install([
    'stark',
  ]);
  $this
    ->assertSame('core/themes/stark/stark.info.yml', \Drupal::service('extension.list.theme')
    ->getPathname('stark'));

  // Retrieving the location of a theme engine.
  $this
    ->assertSame('core/themes/engines/twig/twig.info.yml', \Drupal::service('extension.list.theme_engine')
    ->getPathname('twig'));

  // Retrieving the location of a profile. Profiles are a special case with
  // a fixed location and naming.
  $this
    ->assertSame('core/profiles/testing/testing.info.yml', \Drupal::service('extension.list.profile')
    ->getPathname('testing'));
}