1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-01 19:00:20 +02:00

Removed testing a mock instead of the real handler

This commit is contained in:
ChristianB
2013-01-30 19:37:42 +01:00
parent a82bac49f2
commit 32145bc49e

View File

@@ -1,62 +1,60 @@
<?php <?php
/* /*
* This file is part of the Monolog package. * This file is part of the Monolog package.
* *
* (c) Jordi Boggiano <j.boggiano@seld.be> * (c) Jordi Boggiano <j.boggiano@seld.be>
* *
* For the full copyright and license information, please view the LICENSE * For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
namespace Monolog\Handler; namespace Monolog\Handler;
use Monolog\Logger; use Monolog\Logger;
use Monolog\TestCase; use Monolog\TestCase;
class ZendMonitorHandlerTest extends TestCase class ZendMonitorHandlerTest extends TestCase
{ {
protected $zendMonitorHandler; protected $zendMonitorHandler;
public function setUp() public function setUp()
{ {
if (!function_exists('zend_monitor_custom_event')) { if (!function_exists('zend_monitor_custom_event')) {
$this->markTestSkipped('ZendServer is not installed'); $this->markTestSkipped('ZendServer is not installed');
} }
} }
/** /**
* @covers \Monolog\Handler\ZendMonitor::__construct * @covers \Monolog\Handler\ZendMonitor::__construct
* @covers \Monolog\Handler\ZendMonitor::isZendServer * @covers \Monolog\Handler\ZendMonitor::isZendServer
*/ */
public function testIsZendServerReturnsTrue() public function testIsZendServerReturnsTrue()
{ {
$zendMonitor = $this->getMockBuilder('Monolog\Handler\ZendMonitorHandler') $zendMonitor = new ZendMonitorHandler();
->setMethods(null) $this->assertTrue($zendMonitor->isZendServer());
->getMock(); }
$this->assertTrue($zendMonitor->isZendServer());
} /**
* @covers \Monolog\Handler\ZendMonitor::write
/** */
* @covers \Monolog\Handler\ZendMonitor::write public function testWrite()
*/ {
public function testWrite() $zendMonitor = $this->getMockBuilder('Monolog\Handler\ZendMonitorHandler')
{ ->setMethods(array('writeZendMonitorCustomEvent'))
$zendMonitor = $this->getMockBuilder('Monolog\Handler\ZendMonitorHandler') ->getMock();
->setMethods(array('writeZendMonitorCustomEvent')) $zendMonitor->expects($this->once())
->getMock(); ->method('writeZendMonitorCustomEvent');
$zendMonitor->expects($this->once()) $zendMonitor->handle(
->method('writeZendMonitorCustomEvent'); array(
$zendMonitor->handle( 'message' => 'addDebug Message',
array( 'context' => array(),
'message' => 'addDebug Message', 'level' => Logger::DEBUG,
'context' => array(), 'level_name' => 'DEBUG',
'level' => Logger::DEBUG, 'channel' => 'zendmonitor',
'level_name' => 'DEBUG', 'extra' => array(),
'channel' => 'zendmonitor', 'formatted' => '[2013-01-30 19:07:32] zendmonitor.DEBUG: addDebug Message [] []'
'extra' => array(), )
'formatted' => '[2013-01-30 19:07:32] zendmonitor.DEBUG: addDebug Message [] []' );
) }
);
} }
}