summaryrefslogtreecommitdiff
path: root/modules/simpletest/tests
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2009-10-05 02:48:39 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2009-10-05 02:48:39 +0000
commit1e23b91bc886b30e7a64c7c118a79071c706e39c (patch)
treea2172e7d3a286508ab738db0971657f7b545b3bf /modules/simpletest/tests
parent93eb8b341392b5a04488d0d3a0a9d8136da6a2cf (diff)
downloadbrdo-1e23b91bc886b30e7a64c7c118a79071c706e39c.tar.gz
brdo-1e23b91bc886b30e7a64c7c118a79071c706e39c.tar.bz2
#472820 by rfay, Rob Loach, and catch: Fixed improper whitespace removal/invalid CSS from drupal_load_stylesheet_content() (with tests).
Diffstat (limited to 'modules/simpletest/tests')
-rw-r--r--modules/simpletest/tests/common.test45
1 files changed, 45 insertions, 0 deletions
diff --git a/modules/simpletest/tests/common.test b/modules/simpletest/tests/common.test
index e7b5af694..291750982 100644
--- a/modules/simpletest/tests/common.test
+++ b/modules/simpletest/tests/common.test
@@ -625,6 +625,51 @@ class DrupalCSSIdentifierTestCase extends DrupalUnitTestCase {
}
}
+
+/**
+ * CSS Unit Tests.
+ */
+class CascadingStylesheetsUnitTestCase extends DrupalWebTestCase {
+ public static function getInfo() {
+ return array(
+ 'name' => 'CSS Unit Tests',
+ 'description' => 'Unit tests on CSS functions like aggregation.',
+ 'group' => 'System',
+ );
+ }
+
+ /**
+ * Tests basic CSS loading with and without optimization
+ * (drupal_load_stylesheet()).
+ * This can be enhanced by adding additional css files with variant test cases.
+ * Currently, this is specifically testing to make sure that whitespace
+ * is treated with adequate respect (not arbitrarily removing linefeeds).
+ */
+ function testLoadCssBasic() {
+ /**
+ * Array of files to test. Original = .css,
+ * unoptimized expected output = .css.unoptimized.css,
+ * optimized expected = .css.optimized.css
+ * They live in the simpletest/files/css_test_files directory
+ */
+ $testfiles = array('css_input_without_import.css', );
+ $path = drupal_get_path('module', 'simpletest') . '/files/css_test_files';
+ foreach ($testfiles as $file) {
+ $expected = file_get_contents("$path/$file.unoptimized.css");
+ $unoptimized_output = drupal_load_stylesheet("$path/$file", FALSE);
+ $this->assertEqual($unoptimized_output, $expected,
+ t('Loaded CSS Stylesheet has expected contents (unoptimized) (@file)',
+ array('@file' => $file)));
+ $expected = file_get_contents("$path/$file.optimized.css");
+ $optimized_output = drupal_load_stylesheet("$path/$file", TRUE);
+ $this->assertEqual($optimized_output, $expected,
+ t('Loaded CSS Stylesheet has expected contents (optimized) (@file)',
+ array('@file' => $file)));
+ }
+ }
+}
+
+
/**
* Test drupal_http_request().
*/