| 1 |
<?php
|
| 2 |
// $Id$
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
* Tests for color module.
|
| 7 |
*/
|
| 8 |
|
| 9 |
/**
|
| 10 |
* Test color functionality.
|
| 11 |
*/
|
| 12 |
class ColorTestCase extends DrupalWebTestCase {
|
| 13 |
protected $big_user;
|
| 14 |
|
| 15 |
public static function getInfo() {
|
| 16 |
return array(
|
| 17 |
'name' => 'Color functionality',
|
| 18 |
'description' => 'Modify the garland theme color and make sure the changes are reflected on the frontend',
|
| 19 |
'group' => 'Color',
|
| 20 |
);
|
| 21 |
}
|
| 22 |
|
| 23 |
function setUp() {
|
| 24 |
parent::setUp('color');
|
| 25 |
// Create users.
|
| 26 |
$this->big_user = $this->drupalCreateUser(array('administer site configuration'));
|
| 27 |
}
|
| 28 |
|
| 29 |
/**
|
| 30 |
* Test color module functionality.
|
| 31 |
*/
|
| 32 |
function testColor() {
|
| 33 |
$this->drupalLogin($this->big_user);
|
| 34 |
$this->drupalGet('admin/appearance/settings/garland');
|
| 35 |
$this->assertResponse(200);
|
| 36 |
$edit['scheme'] = '';
|
| 37 |
$edit['palette[link]'] = '#123456';
|
| 38 |
$this->drupalPost('admin/appearance/settings/garland', $edit, t('Save configuration'));
|
| 39 |
|
| 40 |
global $theme_key;
|
| 41 |
$this->drupalGet('<front>');
|
| 42 |
$stylesheets = variable_get('color_' . $theme_key . '_stylesheets', array());
|
| 43 |
$this->assertPattern('|' . file_create_url($stylesheets[0]) . '|', 'Make sure the color stylesheet is included in the content.');
|
| 44 |
|
| 45 |
$stylesheet_content = join("\n", file($stylesheets[0]));
|
| 46 |
$matched = preg_match('/(.*color: #123456.*)/i', $stylesheet_content, $matches);
|
| 47 |
$this->assertTrue($matched == 1, 'Make sure the color we changed is in the color stylesheet.');
|
| 48 |
}
|
| 49 |
|
| 50 |
}
|