function ThemeTest::testInstallAndSetAsDefault in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/src/Tests/System/ThemeTest.php \Drupal\system\Tests\System\ThemeTest::testInstallAndSetAsDefault()
Tests installing a theme and setting it as default.
File
- core/
modules/ system/ src/ Tests/ System/ ThemeTest.php, line 381 - Contains \Drupal\system\Tests\System\ThemeTest.
Class
- ThemeTest
- Tests the theme interface functionality by enabling and switching themes, and using an administration theme.
Namespace
Drupal\system\Tests\SystemCode
function testInstallAndSetAsDefault() {
$this
->drupalGet('admin/appearance');
// Bartik is uninstalled in the test profile and has the third "Install and
// set as default" link.
$this
->clickLink(t('Install and set as default'), 2);
// Test the confirmation message.
$this
->assertText('Bartik is now the default theme.');
// Make sure Bartik is now set as the default theme in config.
$this
->assertEqual($this
->config('system.theme')
->get('default'), 'bartik');
// This checks for a regression. See https://www.drupal.org/node/2498691.
$this
->assertNoText('The bartik theme was not found.');
$themes = \Drupal::service('theme_handler')
->rebuildThemeData();
$version = $themes['bartik']->info['version'];
// Confirm Bartik is indicated as the default theme.
$this
->assertTextPattern('/Bartik ' . preg_quote($version) . '\\s{2,}\\(default theme\\)/');
}