You are here

function SystemThemeFunctionalTest::testSwitchDefaultTheme in Drupal 7

Test switching the default theme.

File

modules/system/system.test, line 2026
Tests for system.module.

Class

SystemThemeFunctionalTest
Tests for the theme interface functionality.

Code

function testSwitchDefaultTheme() {

  // Enable "stark" and set it as the default theme.
  theme_enable(array(
    'stark',
  ));
  $this
    ->drupalGet('admin/appearance');
  $this
    ->clickLink(t('Set default'), 1);
  $this
    ->assertTrue(variable_get('theme_default', '') == 'stark', 'Site default theme switched successfully.');

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

  // Switch back to Bartik 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('Bartik(' . t('active tab') . ')', 'Default local task on blocks admin page has changed.');
}