Brak opisu

PsrLogMessageProcessorTest.php 1.0KB

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\Processor;
  11. class PsrLogMessageProcessorTest extends \PHPUnit_Framework_TestCase
  12. {
  13. /**
  14. * @dataProvider getPairs
  15. */
  16. public function testReplacement($val, $expected)
  17. {
  18. $proc = new PsrLogMessageProcessor;
  19. $message = $proc(array(
  20. 'message' => '{foo}',
  21. 'context' => array('foo' => $val),
  22. ));
  23. $this->assertEquals($expected, $message['message']);
  24. }
  25. public function getPairs()
  26. {
  27. return array(
  28. array('foo', 'foo'),
  29. array('3', '3'),
  30. array(3, '3'),
  31. array(null, ''),
  32. array(true, '1'),
  33. array(false, ''),
  34. array(new \stdClass, '[object stdClass]'),
  35. array(array(), '[array]'),
  36. );
  37. }
  38. }