You are here

public function SiteBannerColorUnitTestCase::testBackgroundColorsAreValid in Site Banner 7

Tests whether all text colors pass validation.

File

./site_banner.test, line 54

Class

SiteBannerColorUnitTestCase
Implements tests for checking that preset colors are valid.

Code

public function testBackgroundColorsAreValid() {
  $background_colors = site_banner_get_background_colors();
  $result = TRUE;
  foreach (array_keys($background_colors) as $color_code) {
    $regex_result = preg_match(site_banner_get_html_color_regex_pattern(), $color_code);
    $result = !($regex_result === FALSE || $regex_result === 0);
  }
  $message = 'Background colors should be valid HTML colors.';
  $this
    ->assertTrue($result, $message);
}