summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2010-11-13 14:06:43 +0000
committerDries Buytaert <dries@buytaert.net>2010-11-13 14:06:43 +0000
commit346854c12e5ce1560df35de492a4c283623dccfb (patch)
tree2766a148aefaf1cd4a2e92d2156c547f49d7fa68 /modules
parentb51569528f42fbecbcefc4ffb2d9b982d43e0186 (diff)
downloadbrdo-346854c12e5ce1560df35de492a4c283623dccfb.tar.gz
brdo-346854c12e5ce1560df35de492a4c283623dccfb.tar.bz2
- Patch #927406 by Damien Tournoud, carlos8f, george@dynapres.nl, amateescu, Volx: colorable themes fail when CSS aggregation is enabled due to improper stream wrapper usage.
Diffstat (limited to 'modules')
-rw-r--r--modules/color/color.test17
-rw-r--r--modules/simpletest/tests/common.test15
2 files changed, 22 insertions, 10 deletions
diff --git a/modules/color/color.test b/modules/color/color.test
index 6fb00c26e..f59d8d7ff 100644
--- a/modules/color/color.test
+++ b/modules/color/color.test
@@ -71,8 +71,7 @@ class ColorTestCase extends DrupalWebTestCase {
$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. (' . $theme . ')');
+ $this->assertTrue(strpos($stylesheet_content, 'color: #123456') !== FALSE, 'Make sure the color we changed is in the color stylesheet. (' . $theme . ')');
$this->drupalGet($settings_path);
$this->assertResponse(200);
@@ -82,7 +81,17 @@ class ColorTestCase extends DrupalWebTestCase {
$this->drupalGet('<front>');
$stylesheets = variable_get('color_' . $theme . '_stylesheets', array());
$stylesheet_content = join("\n", file($stylesheets[0]));
- $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 . ')');
+ $this->assertTrue(strpos($stylesheet_content, 'color: ' . $test_values['scheme_color']) !== FALSE, 'Make sure the color we changed is in the color stylesheet. (' . $theme . ')');
+
+ // Test with aggregated CSS turned on.
+ variable_set('preprocess_css', 1);
+ $this->drupalGet('<front>');
+ $stylesheets = variable_get('drupal_css_cache_files', array());
+ $stylesheet_content = '';
+ foreach ($stylesheets as $key => $uri) {
+ $stylesheet_content .= join("\n", file(drupal_realpath($uri)));
+ }
+ $this->assertTrue(strpos($stylesheet_content, 'public://') === FALSE, 'Make sure the color paths have been translated to local paths. (' . $theme . ')');
+ variable_set('preprocess_css', 0);
}
}
diff --git a/modules/simpletest/tests/common.test b/modules/simpletest/tests/common.test
index c63633ee7..82f8b2e39 100644
--- a/modules/simpletest/tests/common.test
+++ b/modules/simpletest/tests/common.test
@@ -881,17 +881,20 @@ class CascadingStylesheetsUnitTest extends DrupalUnitTestCase {
foreach ($testfiles as $file) {
$expected = file_get_contents("$path/$file.unoptimized.css");
$unoptimized_output = drupal_load_stylesheet("$path/$file.unoptimized.css", FALSE);
- $this->verbose('Expected:<pre>' . $expected . '</pre>'
- . 'Actual:<pre>' . $unoptimized_output . '</pre>'
- );
$this->assertEqual($unoptimized_output, $expected, t('Unoptimized CSS file has expected contents (@file)', array('@file' => $file)));
$expected = file_get_contents("$path/$file.optimized.css");
$optimized_output = drupal_load_stylesheet("$path/$file", TRUE);
- $this->verbose('Expected:<pre>' . $expected . '</pre>'
- . 'Actual:<pre>' . $optimized_output . '</pre>'
- );
$this->assertEqual($optimized_output, $expected, t('Optimized CSS file has expected contents (@file)', array('@file' => $file)));
+
+ // Repeat the tests by accessing the stylesheets by URL.
+ $expected = file_get_contents("$path/$file.unoptimized.css");
+ $unoptimized_output_url = drupal_load_stylesheet($GLOBALS['base_url'] . "/$path/$file.unoptimized.css", FALSE);
+ $this->assertEqual($unoptimized_output, $expected, t('Unoptimized CSS file (loaded from an URL) has expected contents (@file)', array('@file' => $file)));
+
+ $expected = file_get_contents("$path/$file.optimized.css");
+ $optimized_output = drupal_load_stylesheet($GLOBALS['base_url'] . "/$path/$file", TRUE);
+ $this->assertEqual($optimized_output, $expected, t('Optimized CSS file (loaded from an URL) has expected contents (@file)', array('@file' => $file)));
}
}
}