/** * Test if trimming a string containing leading whitespace is only * trimmed at the leading lines and not the trailing ones */ public function testTextWithLeadingWhitespaceIsTrimmed() { $ws = new ezcTemplateWhitespaceRemoval(); // Contains text with all whitespace characters at the start $lines = array(array("", "\n"), array("\t", "\r"), array("\v", "\n"), array("a simple line", "\n"), array("and a second one with whitespace to keep ", false)); $leading = array(array("", false), array("", false), array("", false), array("a simple line", "\n"), array("and a second one with whitespace to keep ", false)); // No lines are changed so it should return false $trailing = false; self::assertSame($leading, $ws->trimLeading($lines), 'String with leading WS should be trimmed.'); self::assertSame($trailing, $ws->trimTrailing($lines), 'String without trailing WS should not be trimmed.'); }