You are here

public function ThemekeyWebTestCase::addThemeKeyRule in ThemeKey 7.3

Same name and namespace in other branches
  1. 7 tests/themekey.test \ThemekeyWebTestCase::addThemeKeyRule()
  2. 7.2 tests/themekey.test \ThemekeyWebTestCase::addThemeKeyRule()
4 calls to ThemekeyWebTestCase::addThemeKeyRule()
ThemekeyModulePluginsTestCase::testActivePaths in tests/ThemekeyModulePluginsTestCase.test
ThemekeyModulePluginsTestCase::testHookThemekeyCustomThemeAlter in tests/ThemekeyModulePluginsTestCase.test
ThemekeyRuleChainTestCase::testChildProperty in tests/ThemekeyRuleChainTestCase.test
ThemekeyWebTestCase::simplePropertyTest in tests/themekey.test

File

tests/themekey.test, line 66
Implements tests for the theme switching rules.

Class

ThemekeyWebTestCase
@file Implements tests for the theme switching rules.

Code

public function addThemeKeyRule($property, $operator, $value, $theme, $enabled = '1', $wildcard = '', $parent = 0) {
  $edit = array(
    'new_item[property]' => $property,
    'new_item[wildcard]' => $wildcard,
    'new_item[operator]' => $operator,
    'new_item[value]' => $value,
    'new_item[theme]' => $theme,
    'new_item[enabled]' => $enabled,
  );
  $this
    ->drupalPost('admin/config/user-interface/themekey/properties', $edit, t('Save configuration'));
  foreach (array_reverse(themekey_load_rules()) as $rule) {
    if (($rule['property'] == $property || !empty($wildcard) && $rule['property'] == $wildcard) && $rule['operator'] == $operator && $rule['value'] == $value && $rule['theme'] == $theme && $rule['enabled'] == $enabled) {
      $this->last_rule_id = $rule['id'];
      break;
    }
  }
  if ($parent) {
    $edit = array(
      'old_items[' . $this->last_rule_id . '][parent]' => $parent,
    );
    $this
      ->drupalPost('admin/config/user-interface/themekey/properties', $edit, t('Save configuration'));
  }
}