1 color.test public ColorTestCase::testValidColor()

Tests whether the provided color is valid.

File

core/modules/color/tests/color.test, line 103
Tests for color module.

Class

ColorTestCase
Tests the Color module functionality.

Code

public function testValidColor() {
  config_set('system.core', 'theme_default', 'bartik');
  $settings_path = 'admin/appearance/settings/bartik';

  $this->backdropLogin($this->bigUser);
  $edit['scheme'] = '';

  foreach ($this->colorTests as $color => $is_valid) {
    $edit['palette[bg]'] = $color;
    $this->backdropPost($settings_path, $edit, t('Save theme settings'));

    if ($is_valid) {
      $this->assertText('The configuration options have been saved.');
    }
    else {
      $this->assertText('Main background must be a valid color.');
    }
  }
}