You are here

public function MinifyHtmlUnitTestCase::testMinifyHtmlScriptReplacement in Minify Source HTML 7

Test Minify HTML Script Replacement.

File

tests/minifyhtml.test, line 111

Class

MinifyHtmlUnitTestCase
Minify HTML Unit Tests.

Code

public function testMinifyHtmlScriptReplacement() {
  $input = "<html>\n";
  $input .= "  <head>\n";
  $input .= "    <title>Test HTML</title>\n";
  $input .= "  </head>\n";
  $input .= "  <body>\n";
  $input .= "    <script>\n";
  $input .= "alert('test');\n";
  $input .= "    </script>\n";
  $input .= "  </body>\n";
  $input .= "</html>\n";
  $expected_output = "<html><head><title>Test HTML</title></head><body><script>\n";
  $expected_output .= "alert('test');\n";
  $expected_output .= "</script></body></html>";
  $actual_output = $input;
  minifyhtml_minify($actual_output);
  $this
    ->assertEqual($expected_output, $actual_output, 'Minified source matches expected output.');
}