1.20.x system.test SystemThemeFunctionalTest::testPerThemeSettings()

Test the individual per-theme settings form.

File

modules/system/tests/system.test, line 1737
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'));
  backdrop_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->backdropGet('admin/appearance/settings/test_theme');
  $this->assertNoFieldChecked('edit-test-theme-checkbox', 'The test_theme_checkbox setting is unchecked.');
  $this->backdropPost(NULL, array('test_theme_checkbox' => TRUE), t('Save theme settings'));
  $this->assertText('The configuration options have been saved.');
  $this->assertFieldChecked('edit-test-theme-checkbox', 'The test_theme_checkbox setting is checked.');
  $this->backdropPost(NULL, array('test_theme_checkbox' => FALSE), t('Save theme settings'));
  $this->assertText('The configuration options have been saved.');
  $this->assertNoFieldChecked('edit-test-theme-checkbox', 'The test_theme_checkbox setting is unchecked.');
}