本文整理匯總了PHP中Monolog\Handler\TestHandler::hasEmergencyRecords方法的典型用法代碼示例。如果您正苦於以下問題:PHP TestHandler::hasEmergencyRecords方法的具體用法?PHP TestHandler::hasEmergencyRecords怎麽用?PHP TestHandler::hasEmergencyRecords使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Monolog\Handler\TestHandler
的用法示例。
在下文中一共展示了TestHandler::hasEmergencyRecords方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testEmergency
public function testEmergency()
{
$context = array("foo" => "bar", 'baz' => 'food');
Simple::emergency("hello", $context);
$this->assertTrue($this->handler->hasEmergencyRecords());
foreach ($this->handler->getRecords() as $record) {
$this->assertEquals("hello", $record['message']);
$this->assertEquals("EMERGENCY", $record['level_name']);
$this->assertEquals($context, $record['context']);
}
}
示例2: testHandleProcessOnlyNeededLevels
/**
* @covers Monolog\Handler\FilterHandler::handle
* @covers Monolog\Handler\FilterHandler::setAcceptedLevels
* @covers Monolog\Handler\FilterHandler::isHandling
*/
public function testHandleProcessOnlyNeededLevels()
{
$test = new TestHandler();
$handler = new FilterHandler($test, Logger::INFO, Logger::NOTICE);
$handler->handle($this->getRecord(Logger::DEBUG));
$this->assertFalse($test->hasDebugRecords());
$handler->handle($this->getRecord(Logger::INFO));
$this->assertTrue($test->hasInfoRecords());
$handler->handle($this->getRecord(Logger::NOTICE));
$this->assertTrue($test->hasNoticeRecords());
$handler->handle($this->getRecord(Logger::WARNING));
$this->assertFalse($test->hasWarningRecords());
$handler->handle($this->getRecord(Logger::ERROR));
$this->assertFalse($test->hasErrorRecords());
$handler->handle($this->getRecord(Logger::CRITICAL));
$this->assertFalse($test->hasCriticalRecords());
$handler->handle($this->getRecord(Logger::ALERT));
$this->assertFalse($test->hasAlertRecords());
$handler->handle($this->getRecord(Logger::EMERGENCY));
$this->assertFalse($test->hasEmergencyRecords());
$test = new TestHandler();
$handler = new FilterHandler($test, array(Logger::INFO, Logger::ERROR));
$handler->handle($this->getRecord(Logger::DEBUG));
$this->assertFalse($test->hasDebugRecords());
$handler->handle($this->getRecord(Logger::INFO));
$this->assertTrue($test->hasInfoRecords());
$handler->handle($this->getRecord(Logger::NOTICE));
$this->assertFalse($test->hasNoticeRecords());
$handler->handle($this->getRecord(Logger::ERROR));
$this->assertTrue($test->hasErrorRecords());
$handler->handle($this->getRecord(Logger::CRITICAL));
$this->assertFalse($test->hasCriticalRecords());
}
示例3: testHandleError
public function testHandleError()
{
$logger = new Logger('test', array($handler = new TestHandler()));
$errHandler = new ErrorHandler($logger);
$errHandler->registerErrorHandler(array(E_USER_NOTICE => Logger::EMERGENCY), false);
trigger_error('Foo', E_USER_ERROR);
$this->assertCount(1, $handler->getRecords());
$this->assertTrue($handler->hasErrorRecords());
trigger_error('Foo', E_USER_NOTICE);
$this->assertCount(2, $handler->getRecords());
$this->assertTrue($handler->hasEmergencyRecords());
}