TestCase.php 1.1 KB

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;
  11. class TestCase extends \PHPUnit_Framework_TestCase
  12. {
  13. /**
  14. * @return array Record
  15. */
  16. protected function getRecord($level = Logger::WARNING, $message = 'test')
  17. {
  18. return array(
  19. 'message' => $message,
  20. 'level' => $level,
  21. 'level_name' => Logger::getLevelName($level),
  22. 'channel' => 'test',
  23. 'datetime' => new \DateTime(),
  24. 'extra' => array(),
  25. );
  26. }
  27. /**
  28. * @return Monolog\Formatter\FormatterInterface
  29. */
  30. protected function getIdentityFormatter()
  31. {
  32. $formatter = $this->getMock('Monolog\\Formatter\\FormatterInterface');
  33. $formatter->expects($this->any())
  34. ->method('format')
  35. ->will($this->returnCallback(function($record) { return $record['message']; }));
  36. return $formatter;
  37. }
  38. }