function ColorTest::testValidColor

Tests whether the provided color is valid.

File

drupal/core/modules/color/lib/Drupal/color/Tests/ColorTest.php, line 124
Definition of Drupal\color\Tests\ColorTest.

Class

ColorTest
Tests the Color module functionality.

Namespace

Drupal\color\Tests

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('You must enter a valid hexadecimal color value for Main background.');
    }
  }
}