]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - plugins/Minify/extlib/minify/min_unit_tests/test_Minify_CSS_UriRewriter.php
Added minify plugin
[quix0rs-gnu-social.git] / plugins / Minify / extlib / minify / min_unit_tests / test_Minify_CSS_UriRewriter.php
1 <?php
2
3 require_once '_inc.php';
4
5 require_once 'Minify/CSS/UriRewriter.php';
6
7 function test_Minify_CSS_UriRewriter()
8 {
9     global $thisDir;
10
11     Minify_CSS_UriRewriter::$debugText = '';
12     $in = file_get_contents($thisDir . '/_test_files/css_uriRewriter/in.css');
13     $expected = file_get_contents($thisDir . '/_test_files/css_uriRewriter/exp.css');
14     $actual = Minify_CSS_UriRewriter::rewrite(
15         $in
16         ,$thisDir . '/_test_files/css_uriRewriter' // currentDir
17         ,$thisDir // use DOCUMENT_ROOT = '/full/path/to/min_unit_tests'
18     );
19     
20     $passed = assertTrue($expected === $actual, 'Minify_CSS_UriRewriter');
21     if (__FILE__ === realpath($_SERVER['SCRIPT_FILENAME'])) {
22         echo "\n---Input:\n\n{$in}\n";
23         echo "\n---Output: " .strlen($actual). " bytes\n\n{$actual}\n\n";
24         if (!$passed) {
25             echo "---Expected: " .strlen($expected). " bytes\n\n{$expected}\n\n\n";
26         }
27         
28         // show debugging only when test run directly
29         echo "--- Minify_CSS_UriRewriter::\$debugText\n\n"
30             , Minify_CSS_UriRewriter::$debugText;
31     }
32     
33     Minify_CSS_UriRewriter::$debugText = '';
34     $in = '../../../../assets/skins/sam/sprite.png';
35     $exp = '/yui/assets/skins/sam/sprite.png';
36     $actual = Minify_CSS_UriRewriter::rewriteRelative(
37         $in
38         ,'sf_root_dir\web\yui\menu\assets\skins\sam'
39         ,'sf_root_dir\web'
40     );
41     
42     $passed = assertTrue($exp === $actual, 'Minify_CSS_UriRewriter : Issue 99');
43     if (__FILE__ === realpath($_SERVER['SCRIPT_FILENAME'])) {
44         echo "\n---Input:\n\n{$in}\n";
45         echo "\n---Output: " .strlen($actual). " bytes\n\n{$actual}\n\n";
46         if (!$passed) {
47             echo "---Expected: " .strlen($exp). " bytes\n\n{$exp}\n\n\n";
48         }
49         
50         // show debugging only when test run directly
51         echo "--- Minify_CSS_UriRewriter::\$debugText\n\n"
52             , Minify_CSS_UriRewriter::$debugText;
53     }
54 }
55
56 test_Minify_CSS_UriRewriter();