You are here

public function SiteBannerColorUnitTestCase::testTextColorsAreValid in Site Banner 7

Tests whether all preset text colors pass validation.

File

./site_banner.test, line 69

Class

SiteBannerColorUnitTestCase
Implements tests for checking that preset colors are valid.

Code

public function testTextColorsAreValid() {
  $text_colors = site_banner_get_text_colors();
  $result = TRUE;
  foreach (array_keys($text_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);
}