當前位置: 首頁>>代碼示例>>PHP>>正文


PHP TestHandler::hasEmergencyRecords方法代碼示例

本文整理匯總了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']);
     }
 }
開發者ID:centraldesktop,項目名稱:static-logger,代碼行數:11,代碼來源:SimpleTest.php

示例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());
 }
開發者ID:no-chris,項目名稱:connector,代碼行數:38,代碼來源:FilterHandlerTest.php

示例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());
 }
開發者ID:ngitimfoyo,項目名稱:Nyari-AppPHP,代碼行數:12,代碼來源:ErrorHandlerTest.php


注:本文中的Monolog\Handler\TestHandler::hasEmergencyRecords方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。