function SystemThemeFunctionalTest::testSwitchDefaultTheme

7.x system.test SystemThemeFunctionalTest::testSwitchDefaultTheme()

Test switching the default theme.

File

drupal-7.x/modules/system/system.test, line 1790
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.');
}