You are here

public function ThemekeyWebTestCase::multiplePropertyTest in ThemeKey 7.2

Same name and namespace in other branches
  1. 7 tests/themekey.test \ThemekeyWebTestCase::multiplePropertyTest()

add multiple properties

Parameters

array $properties:

  • property: the property
  • operator: the operator for the rule
  • value: the value
  • url: the url to call (array)

File

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

Class

ThemekeyWebTestCase
@file Implements tests for the theme switching rules.

Code

public function multiplePropertyTest($properties_array) {
  if (!empty($properties_array)) {
    foreach ($properties_array as $key => $property) {
      if (empty($property['url']['path'])) {
        $property['path'] = '<front>';
      }
      if (empty($property['url']['options'])) {
        $property['url']['options'] = array();
      }
      debug($property['property'] . $property['operator'], $property['value']);

      // load page
      $this
        ->drupalGet($property['url']['path'], $property['url']['options']);

      // theme is bartik
      $this
        ->assertTheme('bartik');

      // create ThemeKey Rule
      $this
        ->addThemeKeyRule($property['property'], $property['operator'], $property['value'], 'garland');

      // load page
      $this
        ->drupalGet($property['url']['path'], $property['url']['options']);

      // theme is garland
      $this
        ->assertTheme('garland');
    }
  }
}