You are here

function SystemThemeFunctionalTest::testPerThemeSettings in Drupal 7

Test the individual per-theme settings form.

File

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

Class

SystemThemeFunctionalTest
Tests for the theme interface functionality.

Code

function testPerThemeSettings() {

  // Enable the test theme and the module that controls it. Clear caches in
  // between so that the module's hook_system_theme_info() implementation is
  // correctly registered.
  module_enable(array(
    'theme_test',
  ));
  drupal_flush_all_caches();
  theme_enable(array(
    'test_theme',
  ));

  // Test that the theme-specific settings form can be saved and that the
  // theme-specific checkbox is checked and unchecked as appropriate.
  $this
    ->drupalGet('admin/appearance/settings/test_theme');
  $this
    ->assertNoFieldChecked('edit-test-theme-checkbox', 'The test_theme_checkbox setting is unchecked.');
  $this
    ->drupalPost(NULL, array(
    'test_theme_checkbox' => TRUE,
  ), t('Save configuration'));
  $this
    ->assertText('The test theme setting was saved.');
  $this
    ->assertFieldChecked('edit-test-theme-checkbox', 'The test_theme_checkbox setting is checked.');
  $this
    ->drupalPost(NULL, array(
    'test_theme_checkbox' => FALSE,
  ), t('Save configuration'));
  $this
    ->assertText('The test theme setting was saved.');
  $this
    ->assertNoFieldChecked('edit-test-theme-checkbox', 'The test_theme_checkbox setting is unchecked.');
}