function ColorTestCase::testValidColor

7.x color.test ColorTestCase::testValidColor()

Tests whether the provided color is valid.

File

drupal-7.x/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.');
    }
  }
}