function ExtensionPathResolverTest::testExtensionPathResolving

Same name in other branches
  1. 10 core/tests/Drupal/KernelTests/Core/Bootstrap/ExtensionPathResolverTest.php \Drupal\KernelTests\Core\Bootstrap\ExtensionPathResolverTest::testExtensionPathResolving()
  2. 11.x core/tests/Drupal/KernelTests/Core/Bootstrap/ExtensionPathResolverTest.php \Drupal\KernelTests\Core\Bootstrap\ExtensionPathResolverTest::testExtensionPathResolving()

@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'));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.