function ThemeTest::testSwitchDefaultTheme

Test switching the default theme.

File

drupal/core/modules/system/lib/Drupal/system/Tests/System/ThemeTest.php, line 226
Definition of Drupal\system\Tests\System\ThemeTest.

Class

ThemeTest
Tests the theme interface functionality.

Namespace

Drupal\system\Tests\System

Code

function testSwitchDefaultTheme() {

  // Enable Bartik and set it as the default theme.
  theme_enable(array(
    'bartik',
  ));
  $this
    ->drupalGet('admin/appearance');
  $this
    ->clickLink(t('Set default'));
  $this
    ->assertEqual(variable_get('theme_default', ''), 'bartik');

  // Test the default theme on the secondary links (blocks admin page).
  $this
    ->drupalGet('admin/structure/block');
  $this
    ->assertText('Bartik(' . t('active tab') . ')', 'Default local task on blocks admin page is the default theme.');

  // Switch back to Stark and test again to test that the menu cache is cleared.
  $this
    ->drupalGet('admin/appearance');
  $this
    ->clickLink(t('Set default'), 0);
  $this
    ->drupalGet('admin/structure/block');
  $this
    ->assertText('Stark(' . t('active tab') . ')', 'Default local task on blocks admin page has changed.');
}