You are here

function ColorTestCase::testValidColor in Drupal 7

Tests whether the provided color is valid.

File

modules/color/color.test, line 114
Tests for color module.

Class

ColorTestCase
Tests the Color module functionality.

Code

function testValidColor() {
  variable_set('theme_default', 'bartik');
  $settings_path = 'admin/appearance/settings/bartik';
  $this
    ->drupalLogin($this->big_user);
  $edit['scheme'] = '';
  foreach ($this->colorTests as $color => $is_valid) {
    $edit['palette[bg]'] = $color;
    $this
      ->drupalPost($settings_path, $edit, t('Save configuration'));
    if ($is_valid) {
      $this
        ->assertText('The configuration options have been saved.');
    }
    else {
      $this
        ->assertText('Main background must be a valid hexadecimal CSS color value.');
    }
  }
}