当前位置: 首页>>代码示例>>PHP>>正文


PHP JLog::setInstance方法代码示例

本文整理汇总了PHP中JLog::setInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP JLog::setInstance方法的具体用法?PHP JLog::setInstance怎么用?PHP JLog::setInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JLog的用法示例。


在下文中一共展示了JLog::setInstance方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

 /**
  * Setup.
  *
  * @return void
  */
 protected function setUp()
 {
     require_once dirname(__DIR__) . '/storage/JCacheStorageMock.php';
     require_once __DIR__ . '/JCacheControllerCallback.helper.php';
     // Some tests are affected by the output of the logger, so we clear the logger here.
     JLog::setInstance(null);
 }
开发者ID:joomla-projects,项目名称:media-manager-improvement,代码行数:12,代码来源:JCacheControllerCallbackCallbackTest.php

示例2: setUp

 public function setUp()
 {
     //require_once dirname(dirname(dirname(dirname(dirname(__DIR__))))).'/bootstrap.php';
     jimport('joomla.cache.cache');
     require_once dirname(__DIR__) . '/storage/JCacheStorageMock.php';
     require_once __DIR__ . '/JCacheControllerCallback.helper.php';
     // some tests are affected by the output of the logger, so we clear the logger here.
     JLog::setInstance(null);
 }
开发者ID:rvsjoen,项目名称:joomla-platform,代码行数:9,代码来源:JCacheControllerCallbackCallbackTest.php

示例3: testSetInstance

 /**
  * Test the JLog::setInstance method to make sure that if we set a logger instance JLog is actually going
  * to use it.  We accomplish this by setting an instance of JLogInspector and then performing some
  * operations using JLog::addLogger() to alter the state of the internal instance.  We then check that the
  * JLogInspector instance we created (and set) has the same values we would expect for lookup and configuration
  * so we can assert that the operations we performed using JLog::addLogger() were actually performed on our
  * instance of JLogInspector that was set.
  *
  * @return  void
  *
  * @since   11.1
  */
 public function testSetInstance()
 {
     $log = new JLogInspector();
     JLog::setInstance($log);
     // Add a logger to the JLog object.
     JLog::addLogger(array('logger' => 'w3c'));
     // Get the expected configurations array after adding the single logger.
     $expectedConfigurations = array('55202c195e23298813df4292c827b241' => array('logger' => 'w3c'));
     // Get the expected lookup array after adding the single logger.
     $expectedLookup = array('55202c195e23298813df4292c827b241' => (object) array('priorities' => JLog::ALL, 'categories' => array(), 'exclude' => false));
     // Get the expected loggers array after adding the single logger (hasn't been instantiated yet so null).
     $expectedLoggers = null;
     $this->assertThat($log->configurations, $this->equalTo($expectedConfigurations), 'Line: ' . __LINE__ . '.');
     $this->assertThat($log->lookup, $this->equalTo($expectedLookup), 'Line: ' . __LINE__ . '.');
     $this->assertThat($log->loggers, $this->equalTo($expectedLoggers), 'Line: ' . __LINE__ . '.');
     // Start over so we test that it actually sets the instance appropriately.
     $log = new JLogInspector();
     JLog::setInstance($log);
     // Add a logger to the JLog object.
     JLog::addLogger(array('logger' => 'database', 'db_type' => 'mysql', 'db_table' => '#__test_table'), JLog::ERROR);
     // Get the expected configurations array after adding the single logger.
     $expectedConfigurations = array('b67483f5ba61450d173aae527fa4163f' => array('logger' => 'database', 'db_type' => 'mysql', 'db_table' => '#__test_table'));
     // Get the expected lookup array after adding the single logger.
     $expectedLookup = array('b67483f5ba61450d173aae527fa4163f' => (object) array('priorities' => JLog::ERROR, 'categories' => array(), 'exclude' => false));
     // Get the expected loggers array after adding the single logger (hasn't been instantiated yet so null).
     $expectedLoggers = null;
     $this->assertThat($log->configurations, $this->equalTo($expectedConfigurations), 'Line: ' . __LINE__ . '.');
     $this->assertThat($log->lookup, $this->equalTo($expectedLookup), 'Line: ' . __LINE__ . '.');
     $this->assertThat($log->loggers, $this->equalTo($expectedLoggers), 'Line: ' . __LINE__ . '.');
 }
开发者ID:sural98,项目名称:joomla-cms,代码行数:42,代码来源:JLogTest.php

示例4: testSetInstance

 /**
  * Test the JLog::setInstance method to make sure that if we set a logger instance JLog is actually going
  * to use it.  We accomplish this by setting an instance of JLogInspector and then performing some
  * operations using JLog::addLogger() to alter the state of the internal instance.  We then check that the
  * JLogInspector instance we created (and set) has the same values we would expect for lookup and configuration
  * so we can assert that the operations we performed using JLog::addLogger() were actually performed on our
  * instance of JLogInspector that was set.
  *
  * @return  void
  *
  * @since   11.1
  */
 public function testSetInstance()
 {
     $log = new JLogInspector();
     JLog::setInstance($log);
     // Add a logger to the JLog object.
     JLog::addLogger(array('logger' => 'w3c'));
     // Get the expected configurations array after adding the single logger.
     $expectedConfigurations = array('55202c195e23298813df4292c827b241' => array('logger' => 'w3c'));
     // Get the expected lookup array after adding the single logger.
     $expectedLookup = array('55202c195e23298813df4292c827b241' => (object) array('priorities' => JLog::ALL, 'categories' => array(), 'exclude' => false));
     // Get the expected loggers array after adding the single logger (hasn't been instantiated yet so null).
     $expectedLoggers = null;
     $this->assertEquals($expectedConfigurations, $log->configurations);
     $this->assertEquals($expectedLookup, $log->lookup);
     $this->assertEquals($expectedLoggers, $log->loggers);
     // Start over so we test that it actually sets the instance appropriately.
     $log = new JLogInspector();
     JLog::setInstance($log);
     // Add a logger to the JLog object.
     JLog::addLogger(array('logger' => 'database', 'db_type' => 'mysqli', 'db_table' => '#__test_table'), JLog::ERROR);
     // Get the expected configurations array after adding the single logger.
     $expectedConfigurations = array('2c6b1817bcb404c50f7bbbe9e6ae1429' => array('logger' => 'database', 'db_type' => 'mysqli', 'db_table' => '#__test_table'));
     // Get the expected lookup array after adding the single logger.
     $expectedLookup = array('2c6b1817bcb404c50f7bbbe9e6ae1429' => (object) array('priorities' => JLog::ERROR, 'categories' => array(), 'exclude' => false));
     // Get the expected loggers array after adding the single logger (hasn't been instantiated yet so null).
     $expectedLoggers = null;
     $this->assertEquals($expectedConfigurations, $log->configurations);
     $this->assertEquals($expectedLookup, $log->lookup);
     $this->assertEquals($expectedLoggers, $log->loggers);
 }
开发者ID:joomla-projects,项目名称:media-manager-improvement,代码行数:42,代码来源:JLogTest.php


注:本文中的JLog::setInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。