WildfireFormatterTest.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. /**
  15. * @covers Monolog\Formatter\WildfireFormatter::format
  16. */
  17. public function testDefaultFormatIsLineFormatterWithoutNewLine()
  18. {
  19. $wildfire = new WildfireFormatter();
  20. $record = array(
  21. 'level' => Logger::ERROR,
  22. 'level_name' => 'ERROR',
  23. 'channel' => 'meh',
  24. 'context' => array(),
  25. 'datetime' => new \DateTime,
  26. 'extra' => array('ip' => '127.0.0.1'),
  27. 'message' => 'log',
  28. );
  29. $message = $wildfire->format($record);
  30. $this->assertEquals(
  31. '84|[{"Type":"ERROR","File":"","Line":"","Label":"meh"},"log [] {\\"ip\\":\\"127.0.0.1\\"}"]|',
  32. $message
  33. );
  34. }
  35. }