SystemThemeFunctionalTest::testAdministrationTheme

7 system.test SystemThemeFunctionalTest::testAdministrationTheme()
8 system.test SystemThemeFunctionalTest::testAdministrationTheme()

Test the administration theme functionality.

File

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

Code

function testAdministrationTheme() {
  theme_enable(array('stark'));
  variable_set('theme_default', 'stark');
  // Enable an administration theme and show it on the node admin pages.
  $edit = array(
    'admin_theme' => 'seven', 
    'node_admin_theme' => TRUE,
  );
  $this->drupalPost('admin/appearance', $edit, t('Save configuration'));

  $this->drupalGet('admin/config');
  $this->assertRaw('themes/seven', t('Administration theme used on an administration page.'));

  $this->drupalGet('node/' . $this->node->nid);
  $this->assertRaw('themes/stark', t('Site default theme used on node page.'));

  $this->drupalGet('node/add');
  $this->assertRaw('themes/seven', t('Administration theme used on the add content page.'));

  $this->drupalGet('node/' . $this->node->nid . '/edit');
  $this->assertRaw('themes/seven', t('Administration theme used on the edit content page.'));

  // Disable the admin theme on the node admin pages.
  $edit = array(
    'node_admin_theme' => FALSE,
  );
  $this->drupalPost('admin/appearance', $edit, t('Save configuration'));

  $this->drupalGet('admin/config');
  $this->assertRaw('themes/seven', t('Administration theme used on an administration page.'));

  $this->drupalGet('node/add');
  $this->assertRaw('themes/stark', t('Site default theme used on the add content page.'));

  // Reset to the default theme settings.
  variable_set('theme_default', 'bartik');
  $edit = array(
    'admin_theme' => '0', 
    'node_admin_theme' => FALSE,
  );
  $this->drupalPost('admin/appearance', $edit, t('Save configuration'));

  $this->drupalGet('admin');
  $this->assertRaw('themes/bartik', t('Site default theme used on administration page.'));

  $this->drupalGet('node/add');
  $this->assertRaw('themes/bartik', t('Site default theme used on the add content page.'));
}
Login or register to post comments