From a85675670564146e298227096dbdd81e7b04ec48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 18 Nov 2015 17:23:30 +0200 Subject: [PATCH] port MinifyBuildTest to phpunit --- .../test_Minify_CommentPreserver.php | 35 ------------------- min_unit_tests/test_all.php | 1 - tests/MinifyCommentPreserverTest.php | 30 ++++++++++++++++ 3 files changed, 30 insertions(+), 36 deletions(-) delete mode 100644 min_unit_tests/test_Minify_CommentPreserver.php create mode 100644 tests/MinifyCommentPreserverTest.php diff --git a/min_unit_tests/test_Minify_CommentPreserver.php b/min_unit_tests/test_Minify_CommentPreserver.php deleted file mode 100644 index 7cf4c55..0000000 --- a/min_unit_tests/test_Minify_CommentPreserver.php +++ /dev/null @@ -1,35 +0,0 @@ - "\n/*!*/\n" - ,'/*!*/a' => "\n/*!*/\n1A" - ,'a/*!*//*!*/b' => "2A\n/*!*/\n\n/*!*/\n3B" - ,'a/*!*/b/*!*/' => "4A\n/*!*/\n5B\n/*!*/\n" - ); - - foreach ($inOut as $in => $expected) { - $actual = Minify_CommentPreserver::process($in, '_test_MCP_processor'); - $passed = assertTrue($expected === $actual, 'Minify_CommentPreserver'); - if (__FILE__ === realpath($_SERVER['SCRIPT_FILENAME'])) { - echo "\n---Output: " .countBytes($actual). " bytes\n\n{$actual}\n\n"; - if (!$passed) { - echo "---Expected: " .countBytes($expected). " bytes\n\n{$expected}\n\n\n"; - } - } - } -} - -function _test_MCP_processor($content, $options = array()) -{ - static $callCount = 0; - ++$callCount; - return $callCount . strtoupper($content); -} - -test_Minify_CommentPreserver(); \ No newline at end of file diff --git a/min_unit_tests/test_all.php b/min_unit_tests/test_all.php index 540fbd6..bc473d7 100644 --- a/min_unit_tests/test_all.php +++ b/min_unit_tests/test_all.php @@ -11,7 +11,6 @@ require 'test_Minify_CSS.php'; require 'test_Minify_CSS_UriRewriter.php'; require 'test_Minify_ClosureCompiler.php'; require 'test_Minify_YuiCSS.php'; -require 'test_Minify_CommentPreserver.php'; require 'test_Minify_HTML.php'; require 'test_Minify_ImportProcessor.php'; require 'test_Minify_Lines.php'; diff --git a/tests/MinifyCommentPreserverTest.php b/tests/MinifyCommentPreserverTest.php new file mode 100644 index 0000000..661cc03 --- /dev/null +++ b/tests/MinifyCommentPreserverTest.php @@ -0,0 +1,30 @@ + "\n/*!*/\n", + '/*!*/a' => "\n/*!*/\n1A", + 'a/*!*//*!*/b' => "2A\n/*!*/\n\n/*!*/\n3B", + 'a/*!*/b/*!*/' => "4A\n/*!*/\n5B\n/*!*/\n", + ); + + $processor = array(__CLASS__, '_test_MCP_processor'); + foreach ($inOut as $in => $expected) { + $actual = Minify_CommentPreserver::process($in, $processor); + $this->assertSame($expected, $actual, 'Minify_CommentPreserver'); + } + } + + /** + * @internal + */ + public static function _test_MCP_processor($content, $options = array()) + { + static $callCount = 0; + ++$callCount; + return $callCount . strtoupper($content); + } +} \ No newline at end of file