function ThemeExtensionListTest::testGetlist

Same name in other branches
  1. 8.9.x core/tests/Drupal/KernelTests/Core/Extension/ThemeExtensionListTest.php \Drupal\KernelTests\Core\Extension\ThemeExtensionListTest::testGetlist()
  2. 10 core/tests/Drupal/KernelTests/Core/Extension/ThemeExtensionListTest.php \Drupal\KernelTests\Core\Extension\ThemeExtensionListTest::testGetList()
  3. 11.x core/tests/Drupal/KernelTests/Core/Extension/ThemeExtensionListTest.php \Drupal\KernelTests\Core\Extension\ThemeExtensionListTest::testGetList()

@covers ::getList

File

core/tests/Drupal/KernelTests/Core/Extension/ThemeExtensionListTest.php, line 16

Class

ThemeExtensionListTest
@coversDefaultClass \Drupal\Core\Extension\ThemeExtensionList @group Extension

Namespace

Drupal\KernelTests\Core\Extension

Code

public function testGetlist() {
    \Drupal::configFactory()->getEditable('core.extension')
        ->set('module.testing', 1000)
        ->set('theme.test_theme', 0)
        ->save();
    // The installation profile is provided by a container parameter.
    // Saving the configuration doesn't automatically trigger invalidation
    $this->container
        ->get('kernel')
        ->rebuildContainer();
    
    /** @var \Drupal\Core\Extension\ThemeExtensionList $theme_extension_list */
    $theme_extension_list = \Drupal::service('extension.list.theme');
    $extensions = $theme_extension_list->getList();
    $this->assertArrayHasKey('test_theme', $extensions);
}

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