You are here

public function ThemeExtensionListTest::testGetlist in Drupal 8

Same name and namespace in other branches
  1. 9 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 17

Class

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

Namespace

Drupal\KernelTests\Core\Extension

Code

public function testGetlist() {
  $settings = Settings::getAll();
  $settings['install_profile'] = 'testing';
  new Settings($settings);
  \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);
}