WildfireFormatterTest.php 1.1 KB

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