JsonFormatterTest.php 777 B

12345678910111213141516171819202122232425262728293031
  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 JsonFormatterTest extends \PHPUnit_Framework_TestCase
  13. {
  14. public function testFormat()
  15. {
  16. $formatter = new JsonFormatter();
  17. $message = $formatter->format($msg = array(
  18. 'level_name' => 'WARNING',
  19. 'channel' => 'log',
  20. 'context' => array(),
  21. 'message' => array('foo'),
  22. 'datetime' => new \DateTime,
  23. 'extra' => array(),
  24. ));
  25. $this->assertEquals(json_encode($msg), $message);
  26. }
  27. }