EchoLoggerTest.php 729B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. require_once 'Swift/Tests/SwiftUnitTestCase.php';
  3. require_once 'Swift/Plugins/Loggers/EchoLogger.php';
  4. class Swift_Plugins_Loggers_EchoLoggerTest
  5. extends Swift_Tests_SwiftUnitTestCase
  6. {
  7. public function testAddingEntryDumpsSingleLineWithoutHtml()
  8. {
  9. $logger = new Swift_Plugins_Loggers_EchoLogger(false);
  10. ob_start();
  11. $logger->add(">> Foo");
  12. $data = ob_get_clean();
  13. $this->assertEqual(">> Foo" . PHP_EOL, $data);
  14. }
  15. public function testAddingEntryDumpsEscapedLineWithHtml()
  16. {
  17. $logger = new Swift_Plugins_Loggers_EchoLogger(true);
  18. ob_start();
  19. $logger->add(">> Foo");
  20. $data = ob_get_clean();
  21. $this->assertEqual("&gt;&gt; Foo<br />" . PHP_EOL, $data);
  22. }
  23. }