ZendMonitorHandlerTest.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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 = new ZendMonitorHandler();
  29. $this->assertTrue($zendMonitor->isZendServer());
  30. }
  31. /**
  32. * @covers \Monolog\Handler\ZendMonitor::write
  33. */
  34. public function testWrite()
  35. {
  36. $zendMonitor = $this->getMockBuilder('Monolog\Handler\ZendMonitorHandler')
  37. ->setMethods(array('writeZendMonitorCustomEvent'))
  38. ->getMock();
  39. $zendMonitor->expects($this->once())
  40. ->method('writeZendMonitorCustomEvent');
  41. $zendMonitor->handle(
  42. array(
  43. 'message' => 'addDebug Message',
  44. 'context' => array(),
  45. 'level' => Logger::DEBUG,
  46. 'level_name' => 'DEBUG',
  47. 'channel' => 'zendmonitor',
  48. 'extra' => array(),
  49. 'formatted' => '[2013-01-30 19:07:32] zendmonitor.DEBUG: addDebug Message [] []'
  50. )
  51. );
  52. }
  53. }