function ConfigImporterTest::testThemeInstallReloadsServices
Same name and namespace in other branches
- 11.x core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php \Drupal\KernelTests\Core\Config\ConfigImporterTest::testThemeInstallReloadsServices()
Tests that installing a theme will reload all service dependencies.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Config/ ConfigImporterTest.php, line 955
Class
- ConfigImporterTest
- Tests importing configuration from files into active configuration.
Namespace
Drupal\KernelTests\Core\ConfigCode
public function testThemeInstallReloadsServices() : void {
$this->assertFalse(\Drupal::service(ThemeHandlerInterface::class)->themeExists('test_base_theme'));
$sync = $this->container
->get('config.storage.sync');
// Ensure that the config import will install the theme.
$extensions = $sync->read('core.extension');
$extensions['theme']['test_base_theme'] = 0;
$sync->write('core.extension', $extensions);
$importer = $this->configImporter();
$property = new \ReflectionProperty($importer, 'themeHandler');
$old_theme_handler = $property->getValue($importer);
$this->assertIsObject($old_theme_handler);
$importer->import();
$this->assertTrue(\Drupal::service(ThemeHandlerInterface::class)->themeExists('test_base_theme'));
$new_theme_handler = $property->getValue($importer);
$this->assertIsObject($new_theme_handler);
$this->assertNotSame($old_theme_handler, $new_theme_handler);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.