class LegacyThemeHandlerTest
Tests deprecated theme handler methods.
@group Extension @group legacy
Hierarchy
- class \Drupal\KernelTests\KernelTestBase implements \Drupal\Core\DependencyInjection\ServiceProviderInterface uses \Drupal\KernelTests\AssertLegacyTrait, \Drupal\KernelTests\AssertContentTrait, \Drupal\Tests\AssertHelperTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\PhpunitCompatibilityTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\KernelTests\Core\Extension\LegacyThemeHandlerTest extends \Drupal\KernelTests\KernelTestBase
Expanded class hierarchy of LegacyThemeHandlerTest
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Extension/ LegacyThemeHandlerTest.php, line 13
Namespace
Drupal\KernelTests\Core\ExtensionView source
class LegacyThemeHandlerTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
public static $modules = [
'system',
];
/**
* Tests that a deprecation error is thrown when calling ::setDefault.
*
* @expectedDeprecation Drupal\Core\Extension\ThemeHandler::setDefault is deprecated in drupal:8.2.0 and is removed from drupal:9.0.0. Use the configuration system to edit the system.theme config directly. See https://www.drupal.org/node/3082630
*/
public function testSetDefault() {
$theme_handler = \Drupal::service('theme_handler');
$theme_handler->install([
'bartik',
]);
\Drupal::service('theme_handler')->setDefault('bartik');
$this->assertSame('bartik', \Drupal::config('system.theme')->get('default'));
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
LegacyThemeHandlerTest::$modules | public static | property | |
LegacyThemeHandlerTest::testSetDefault | public | function | Tests that a deprecation error is thrown when calling ::setDefault. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.