function SystemThemeFunctionalTest::testSwitchDefaultTheme

Test switching the default theme.

File

modules/system/system.test, line 2097

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.');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.