function ColorTestCase::testValidColor

Tests whether the provided color is valid.

File

modules/color/color.test, line 114

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.