ZendMonitorHandlerTest.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. $record = $this->getRecord();
  37. $zendMonitor = $this->getMockBuilder('Monolog\Handler\ZendMonitorHandler')
  38. ->setMethods(array('writeZendMonitorCustomEvent'))
  39. ->getMock();
  40. $zendMonitor->expects($this->once())
  41. ->method('writeZendMonitorCustomEvent')
  42. ->with($record['level'], $record['message']);
  43. $zendMonitor->handle($record);
  44. }
  45. }