public function CtoolsCssTestCase::testCssStoreOverwrite in Chaos Tool Suite (ctools) 7
Test that Stored CSS snippets can be correctly overwritten.
File
- tests/
css.test, line 56
Class
- CtoolsCssTestCase
- Test menu links depending on user permissions.
Code
public function testCssStoreOverwrite() {
$css1 = "#some-id .some-class {\n color: black;\n illegal-key: foo;\n}";
$css2 = "#other-id .other-class {\n color: blue;\n illegal-key: foo;\n}";
$filtered_css2 = '#other-id .other-class{color:blue;}';
ctools_css_store('unfiltered-css-test', $css1, FALSE);
ctools_css_store('filtered-css-test', $css1, TRUE);
// Now overwrite the first css with the second version.
$filename3 = ctools_css_store('unfiltered-css-test', $css2, FALSE);
$filename4 = ctools_css_store('filtered-css-test', $css2, TRUE);
$file_contents3 = file_get_contents($filename3);
$file_contents4 = file_get_contents($filename4);
$this
->assertEqual($css2, $file_contents3, 'Unfiltered CSS has overwritten earlier contents.');
$this
->assertEqual($filtered_css2, $file_contents4, 'Filtered CSS has overwritten earlier contents.');
}