diff options
author | webchick <webchick@24967.no-reply.drupal.org> | 2011-06-08 13:43:15 -0700 |
---|---|---|
committer | webchick <webchick@24967.no-reply.drupal.org> | 2011-06-08 13:43:15 -0700 |
commit | f4c0c2da6e153d3648871524a7883d0372098686 (patch) | |
tree | 00a6d8ba7608e659bcc12ef42b442cb4ec192081 /modules/color/color.test | |
parent | 276209f512c4bf6d8c7cf54b4859db17bb472ba5 (diff) | |
download | brdo-f4c0c2da6e153d3648871524a7883d0372098686.tar.gz brdo-f4c0c2da6e153d3648871524a7883d0372098686.tar.bz2 |
Issue #1179424 by aspilicious: Add tests to check for SA-CORE-2011-001
Diffstat (limited to 'modules/color/color.test')
-rw-r--r-- | modules/color/color.test | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/modules/color/color.test b/modules/color/color.test index 1ddfc0647..897bd6cc0 100644 --- a/modules/color/color.test +++ b/modules/color/color.test @@ -11,6 +11,7 @@ class ColorTestCase extends DrupalWebTestCase { protected $big_user; protected $themes; + protected $colorTests; public static function getInfo() { return array( @@ -40,6 +41,19 @@ class ColorTestCase extends DrupalWebTestCase { ), ); theme_enable(array_keys($this->themes)); + + // Array filled with valid and not valid color values + $this->colorTests = array( + '#000' => TRUE, + '#123456' => TRUE, + '#abcdef' => TRUE, + '#0' => FALSE, + '#00' => FALSE, + '#0000' => FALSE, + '#00000' => FALSE, + '123456' => FALSE, + '#00000g' => FALSE, + ); } /** @@ -93,4 +107,27 @@ class ColorTestCase extends DrupalWebTestCase { $this->assertTrue(strpos($stylesheet_content, 'public://') === FALSE, 'Make sure the color paths have been translated to local paths. (' . $theme . ')'); variable_set('preprocess_css', 0); } + + /** + * Test to see if the provided color is valid + */ + 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.'); + } + } + } } |