1 system.test SystemThemeFunctionalTest::testThemeSettings()

Test theme settings.

File

core/modules/system/tests/system.test, line 1856
Tests for system.module.

Class

SystemThemeFunctionalTest
Tests for the theme interface functionality.

Code

function testThemeSettings() {
  theme_enable(array('basis'));
  module_enable(array('color', 'theme_test'));
  backdrop_flush_all_caches();
  // Change Basis settings so config file is created.
  $edit = array();
  $this->backdropPost('admin/appearance/settings/basis', $edit, t('Save theme settings'));

  // Ensure config file exists.
  $config_before = config('basis.settings');

  $this->assertFalse($config_before->isNew(), 'Basis config file exists.');

  theme_disable(array('basis'));

  // Check that config file no longer exists.
  $config_after = config('basis.settings');
  $this->assertTrue($config_after->isNew(), 'Basis config file does not exist.');

  // Test that the theme-specific settings form appears and has correct
  // values pulled from a config file, without a settings array in the info
  // file.
  module_enable(array('theme_test'));
  backdrop_flush_all_caches();
  theme_enable(array('test_theme_config'));

  $this->backdropGet('admin/appearance/settings/test_theme_config');
  $this->assertFieldChecked('edit-test-theme-checkbox-one', 'The checkbox one setting is checked.');
  $this->assertNoFieldChecked('edit-test-theme-checkbox-two', 'The checkbox two setting is unchecked.');
  $this->assertFieldById('edit-test-theme-textfield', 'Default field value');
}