LoggerStub.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. /*
  3. * This file is part of the Stash package.
  4. *
  5. * (c) Robert Hafner <tedivm@tedivm.com>
  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 Stash\Test\Stubs;
  11. use Stash;
  12. /**
  13. * LoggerStub is used to test that logging events are being triggered when they should be.
  14. *
  15. * @package Stash
  16. * @author Robert Hafner <tedivm@tedivm.com>
  17. *
  18. * @codeCoverageIgnore
  19. */
  20. class LoggerStub
  21. {
  22. public $lastContext;
  23. public $lastLevel;
  24. public $lastMessage;
  25. public function emergency($message, array $context = array())
  26. {
  27. $this->log('emergency', $message, $context);
  28. }
  29. public function alert($message, array $context = array())
  30. {
  31. $this->log('alert', $message, $context);
  32. }
  33. public function critical($message, array $context = array())
  34. {
  35. $this->log('critical', $message, $context);
  36. }
  37. public function error($message, array $context = array())
  38. {
  39. $this->log('error', $message, $context);
  40. }
  41. public function warning($message, array $context = array())
  42. {
  43. $this->log('warning', $message, $context);
  44. }
  45. public function notice($message, array $context = array())
  46. {
  47. $this->log('notice', $message, $context);
  48. }
  49. public function info($message, array $context = array())
  50. {
  51. $this->log('info', $message, $context);
  52. }
  53. public function debug($message, array $context = array())
  54. {
  55. $this->log('debug', $message, $context);
  56. }
  57. public function log($level, $message, array $context = array())
  58. {
  59. $this->lastLevel = $level;
  60. $this->lastMessage = $message;
  61. $this->lastContext = $context;
  62. }
  63. }