PsrLogMessageProcessorTest.php 996 B

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([
  20. 'message' => '{foo}',
  21. 'context' => ['foo' => $val],
  22. ]);
  23. $this->assertEquals($expected, $message['message']);
  24. }
  25. public function getPairs()
  26. {
  27. return [
  28. ['foo', 'foo'],
  29. ['3', '3'],
  30. [3, '3'],
  31. [null, ''],
  32. [true, '1'],
  33. [false, ''],
  34. [new \stdClass, '[object stdClass]'],
  35. [[], '[array]'],
  36. ];
  37. }
  38. }