diff options
author | Craig Andrews <candrews@integralblue.com> | 2009-12-04 18:44:26 -0500 |
---|---|---|
committer | Craig Andrews <candrews@integralblue.com> | 2009-12-04 18:44:26 -0500 |
commit | aab7344002fd390e5b62a3eb82f3a418fd294617 (patch) | |
tree | b214e7d4b3e9f0ca9818fea9e3d9efa0249c00c6 /plugins/Minify/extlib/minify/min_unit_tests/test_Minify_CSS_UriRewriter.php | |
parent | 1fd7e5e3794621993b01a5833faa8b6fa26c3847 (diff) | |
parent | 01b089d9be046db1253cb3bb90e8635b50fddd84 (diff) |
Merge branch 'minify' into 0.9.x
Diffstat (limited to 'plugins/Minify/extlib/minify/min_unit_tests/test_Minify_CSS_UriRewriter.php')
-rw-r--r-- | plugins/Minify/extlib/minify/min_unit_tests/test_Minify_CSS_UriRewriter.php | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/plugins/Minify/extlib/minify/min_unit_tests/test_Minify_CSS_UriRewriter.php b/plugins/Minify/extlib/minify/min_unit_tests/test_Minify_CSS_UriRewriter.php new file mode 100644 index 000000000..55f09b053 --- /dev/null +++ b/plugins/Minify/extlib/minify/min_unit_tests/test_Minify_CSS_UriRewriter.php @@ -0,0 +1,56 @@ +<?php + +require_once '_inc.php'; + +require_once 'Minify/CSS/UriRewriter.php'; + +function test_Minify_CSS_UriRewriter() +{ + global $thisDir; + + Minify_CSS_UriRewriter::$debugText = ''; + $in = file_get_contents($thisDir . '/_test_files/css_uriRewriter/in.css'); + $expected = file_get_contents($thisDir . '/_test_files/css_uriRewriter/exp.css'); + $actual = Minify_CSS_UriRewriter::rewrite( + $in + ,$thisDir . '/_test_files/css_uriRewriter' // currentDir + ,$thisDir // use DOCUMENT_ROOT = '/full/path/to/min_unit_tests' + ); + + $passed = assertTrue($expected === $actual, 'Minify_CSS_UriRewriter'); + if (__FILE__ === realpath($_SERVER['SCRIPT_FILENAME'])) { + echo "\n---Input:\n\n{$in}\n"; + echo "\n---Output: " .strlen($actual). " bytes\n\n{$actual}\n\n"; + if (!$passed) { + echo "---Expected: " .strlen($expected). " bytes\n\n{$expected}\n\n\n"; + } + + // show debugging only when test run directly + echo "--- Minify_CSS_UriRewriter::\$debugText\n\n" + , Minify_CSS_UriRewriter::$debugText; + } + + Minify_CSS_UriRewriter::$debugText = ''; + $in = '../../../../assets/skins/sam/sprite.png'; + $exp = '/yui/assets/skins/sam/sprite.png'; + $actual = Minify_CSS_UriRewriter::rewriteRelative( + $in + ,'sf_root_dir\web\yui\menu\assets\skins\sam' + ,'sf_root_dir\web' + ); + + $passed = assertTrue($exp === $actual, 'Minify_CSS_UriRewriter : Issue 99'); + if (__FILE__ === realpath($_SERVER['SCRIPT_FILENAME'])) { + echo "\n---Input:\n\n{$in}\n"; + echo "\n---Output: " .strlen($actual). " bytes\n\n{$actual}\n\n"; + if (!$passed) { + echo "---Expected: " .strlen($exp). " bytes\n\n{$exp}\n\n\n"; + } + + // show debugging only when test run directly + echo "--- Minify_CSS_UriRewriter::\$debugText\n\n" + , Minify_CSS_UriRewriter::$debugText; + } +} + +test_Minify_CSS_UriRewriter();
\ No newline at end of file |