WildfireFormatterTest.php 1000 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /*
  3. * This file is part of the Monolog package.
  4. *
  5. * (c) Jordi Boggiano <j.boggiano@seld.be>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Monolog\Formatter;
  11. use Monolog\Logger;
  12. class WildfireFormatterTest extends \PHPUnit_Framework_TestCase
  13. {
  14. public function testDefaultFormatIsLineFormatterWithoutNewLine()
  15. {
  16. $wildfire = new WildfireFormatter();
  17. $record = array(
  18. 'level' => Logger::ERROR,
  19. 'level_name' => 'ERROR',
  20. 'channel' => 'meh',
  21. 'context' => array(),
  22. 'datetime' => new \DateTime,
  23. 'extra' => array('ip' => '127.0.0.1'),
  24. 'message' => 'log',
  25. );
  26. $message = $wildfire->format($record);
  27. $this->assertEquals(
  28. '84|[{"Type":"ERROR","File":"","Line":"","Label":"meh"},"log [] {\\"ip\\":\\"127.0.0.1\\"}"]|',
  29. $message
  30. );
  31. }
  32. }