diff options
author | Dries Buytaert <dries@buytaert.net> | 2010-08-08 19:35:49 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2010-08-08 19:35:49 +0000 |
commit | e3a52979f60fe66b66e7eea9e4a8213ded7ff834 (patch) | |
tree | 4dc684cb65ad81dbe431f96690dd073876dbd0c8 /modules/color | |
parent | 1c4b5b9f44ade9ee155fc5293376210c607c0b7b (diff) | |
download | brdo-e3a52979f60fe66b66e7eea9e4a8213ded7ff834.tar.gz brdo-e3a52979f60fe66b66e7eea9e4a8213ded7ff834.tar.bz2 |
- Patch #865072 by bleen18, jhodgdon: updates to reflect that Bartik is default theme now.
Diffstat (limited to 'modules/color')
-rw-r--r-- | modules/color/color.test | 58 |
1 files changed, 41 insertions, 17 deletions
diff --git a/modules/color/color.test b/modules/color/color.test index dff4e6d72..b13f30ff4 100644 --- a/modules/color/color.test +++ b/modules/color/color.test @@ -11,11 +11,12 @@ */ class ColorTestCase extends DrupalWebTestCase { protected $big_user; + protected $themes; public static function getInfo() { return array( 'name' => 'Color functionality', - 'description' => 'Modify the garland theme color and make sure the changes are reflected on the frontend', + 'description' => 'Modify the Bartik and Garland theme colors and make sure the changes are reflected on the frontend', 'group' => 'Color', ); } @@ -26,40 +27,63 @@ class ColorTestCase extends DrupalWebTestCase { // Create users. $this->big_user = $this->drupalCreateUser(array('administer themes')); - // This test relies on Garland, the mother of all the colorable themes. - theme_enable(array('garland')); - variable_set('theme_default', 'garland'); + // This tests the color module in both Bartik and Garland. + $this->themes = array( + 'bartik' => array( + 'palette_input' => 'palette[bg]', + 'scheme' => 'Slate', + 'scheme_color' => '#3b3b3b', + ), + 'garland' => array( + 'palette_input' => 'palette[link]', + 'scheme' => 'greenbeam', + 'scheme_color' => '#0c7a00', + ), + ); + theme_enable(array_keys($this->themes)); } /** * Test color module functionality. */ function testColor() { + foreach ($this->themes as $theme => $test_values) { + debug($theme); + $this->_testColor($theme, $test_values); + } + } + + /** + * Tests color module functionality using the given theme. + */ + function _testColor($theme, $test_values) { + variable_set('theme_default', $theme); + $settings_path = 'admin/appearance/settings/' . $theme; + $this->drupalLogin($this->big_user); - $this->drupalGet('admin/appearance/settings/garland'); + $this->drupalGet($settings_path); $this->assertResponse(200); $edit['scheme'] = ''; - $edit['palette[link]'] = '#123456'; - $this->drupalPost('admin/appearance/settings/garland', $edit, t('Save configuration')); + $edit[$test_values['palette_input']] = '#123456'; + $this->drupalPost($settings_path, $edit, t('Save configuration')); $this->drupalGet('<front>'); - $stylesheets = variable_get('color_garland_stylesheets', array()); - $this->assertPattern('|' . file_create_url($stylesheets[0]) . '|', 'Make sure the color stylesheet is included in the content.'); + $stylesheets = variable_get('color_' . $theme . '_stylesheets', array()); + $this->assertPattern('|' . file_create_url($stylesheets[0]) . '|', 'Make sure the color stylesheet is included in the content. (' . $theme . ')'); $stylesheet_content = join("\n", file($stylesheets[0])); $matched = preg_match('/(.*color: #123456.*)/i', $stylesheet_content, $matches); - $this->assertTrue($matched == 1, 'Make sure the color we changed is in the color stylesheet.'); + $this->assertTrue($matched == 1, 'Make sure the color we changed is in the color stylesheet. (' . $theme . ')'); - $this->drupalGet('admin/appearance/settings/garland'); + $this->drupalGet($settings_path); $this->assertResponse(200); - $edit['scheme'] = 'greenbeam'; - $this->drupalPost('admin/appearance/settings/garland', $edit, t('Save configuration')); + $edit['scheme'] = $test_values['scheme']; + $this->drupalPost($settings_path, $edit, t('Save configuration')); $this->drupalGet('<front>'); - $stylesheets = variable_get('color_garland_stylesheets', array()); + $stylesheets = variable_get('color_' . $theme . '_stylesheets', array()); $stylesheet_content = join("\n", file($stylesheets[0])); - $matched = preg_match('/(.*color: #0c7a00.*)/i', $stylesheet_content, $matches); - $this->assertTrue($matched == 1, 'Make sure the color we changed is in the color stylesheet.'); + $matched = preg_match('/(.*color: ' . $test_values['scheme_color'] . '.*)/i', $stylesheet_content, $matches); + $this->assertTrue($matched == 1, 'Make sure the color we changed is in the color stylesheet. (' . $theme . ')'); } - } |