$paddedSpace = str_repeat(' ', 80); $colorizer->colorize($paddedText, 'RED')->returns('<RED>' . $paddedText . '</RED>'); $colorizer->colorize($paddedSpace, 'RED')->returns('<RED>' . $paddedSpace . '</RED>'); $colorizer->replay(); // test ob_start(); $printer->printLargeBox('My text', 'RED'); $result = ob_get_clean(); // assertions $t->is($result, "\n<RED>" . $paddedSpace . "</RED>\n<RED>" . $paddedText . "</RED>\n<RED>" . $paddedSpace . "</RED>\n\n", 'The result was colorized and printed'); // @Test: The printer does also work without colorizer // fixtures $printer = new LimePrinter(); // test ob_start(); $printer->printText('My text'); $result = ob_get_clean(); // assertions $t->is($result, 'My text', 'The result was printed'); // @Test: Strings in unformatted text are automatically formatted // fixtures $colorizer->colorize('"Test string"', LimePrinter::STRING)->returns('<BLUE>"Test string"</BLUE>'); $colorizer->replay(); // test ob_start(); $printer->printText('My text with a "Test string"'); $result = ob_get_clean(); // assertions $t->is($result, 'My text with a <BLUE>"Test string"</BLUE>', 'The result was colorized and printed'); // @Test: Integers in unformatted text are automatically formatted // fixtures