ZendMonitorHandlerTest.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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\Handler;
  11. use Monolog\Logger;
  12. use Monolog\TestCase;
  13. class ZendMonitorHandlerTest extends TestCase
  14. {
  15. protected $zendMonitorHandler;
  16. public function setUp()
  17. {
  18. if (!function_exists('zend_monitor_custom_event')) {
  19. $this->markTestSkipped('ZendServer is not installed');
  20. }
  21. }
  22. /**
  23. * @covers \Monolog\Handler\ZendMonitor::__construct
  24. * @covers \Monolog\Handler\ZendMonitor::isZendServer
  25. */
  26. public function testIsZendServerReturnsTrue()
  27. {
  28. $zendMonitor = $this->getMockBuilder('Monolog\Handler\ZendMonitorHandler')
  29. ->setMethods(null)
  30. ->getMock();
  31. $this->assertTrue($zendMonitor->isZendServer());
  32. }
  33. /**
  34. * @covers \Monolog\Handler\ZendMonitor::write
  35. */
  36. public function testWrite()
  37. {
  38. $zendMonitor = $this->getMockBuilder('Monolog\Handler\ZendMonitorHandler')
  39. ->setMethods(array('writeZendMonitorCustomEvent'))
  40. ->getMock();
  41. $zendMonitor->expects($this->once())
  42. ->method('writeZendMonitorCustomEvent');
  43. $zendMonitor->handle(
  44. array(
  45. 'message' => 'addDebug Message',
  46. 'context' => array(),
  47. 'level' => Logger::DEBUG,
  48. 'level_name' => 'DEBUG',
  49. 'channel' => 'zendmonitor',
  50. 'extra' => array(),
  51. 'formatted' => '[2013-01-30 19:07:32] zendmonitor.DEBUG: addDebug Message [] []'
  52. )
  53. );
  54. }
  55. }