JsonFormatterTest.php 743 B

123456789101112131415161718192021222324252627282930
  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. 'message' => array('foo'),
  21. 'datetime' => new \DateTime,
  22. 'extra' => array(),
  23. ));
  24. $this->assertEquals(json_encode($msg), $message);
  25. }
  26. }