You are here

public function ThemeExtensionListTest::testGetlist in Drupal 9

Same name and namespace in other branches
  1. 8 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);
}