WildfireFormatterTest.php 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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('from' => 'logger'),
  25. 'datetime' => new \DateTime("@0"),
  26. 'extra' => array('ip' => '127.0.0.1'),
  27. 'message' => 'log',
  28. );
  29. $message = $wildfire->format($record);
  30. $this->assertEquals(
  31. '125|[{"Type":"ERROR","File":"","Line":"","Label":"meh"},'
  32. .'{"message":"log","context":{"from":"logger"},"extra":{"ip":"127.0.0.1"}}]|',
  33. $message
  34. );
  35. }
  36. }