public function CtoolsCssTestCase::testCssStoreFilterRetrieve in Chaos Tool Suite (ctools) 7
Test that Stored CSS snippets can be retrieved, filtered or otherwise.
File
- tests/
css.test, line 32
Class
- CtoolsCssTestCase
- Test menu links depending on user permissions.
Code
public function testCssStoreFilterRetrieve() {
$css = "#some-id .some-class {\n color: black;\n illegal-key: foo;\n}";
$filtered_css = '#some-id .some-class{color:black;}';
$this
->assertNull(ctools_css_retrieve('missing-css-test'), 'Missing css snippet is not found');
$filename1 = ctools_css_store('unfiltered-css-test', $css, FALSE);
$filename2 = ctools_css_store('filtered-css-test', $css, TRUE);
$file_contents = file_get_contents($filename1);
$this
->assertEqual($css, $file_contents, 'Unfiltered css file contents are correct');
$this
->assertEqual($filename1, ctools_css_retrieve('unfiltered-css-test'), 'Unfiltered css file successfully fetched');
$file_contents = file_get_contents($filename1);
$this
->assertEqual($css, $file_contents, 'Unfiltered css file contents are correct');
$this
->assertEqual($filename2, ctools_css_retrieve('filtered-css-test'), 'Filtered css file succcesfully fetched');
$file_contents = file_get_contents($filename2);
$this
->assertEqual($filtered_css, $file_contents, 'Filtered css file contents are correct');
}