コード例 #1
0
 /**
  * Sets up the fixture, for example, open a network connection.
  * This method is called before a test is executed.
  *
  * @return void
  */
 protected function setUp()
 {
     $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['mklog']['nolog'] = true;
     $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['devlog']['nolog'] = true;
     \DMK\Mklog\Factory::getStorage()->unsLoggingActive();
     $extConf = \DMK\Mklog\Factory::getConfigUtility()->getExtConf();
     $extConf->setMinLogLevel(7);
     $extConf->setExcludeExtKeys('');
 }
コード例 #2
0
 /**
  * Is logging enabled?
  *
  * @return bool
  */
 protected function isLoggingEnabled()
 {
     // skip logging, if there is no db.
     if (empty($GLOBALS['TYPO3_DB']) || !is_object($GLOBALS['TYPO3_DB'])) {
         return false;
     }
     // skip if logging is disabled
     if ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['mklog']['nolog'] || $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['devlog']['nolog']) {
         return false;
     }
     // now check some cachable options
     $storage = \DMK\Mklog\Factory::getStorage();
     if ($storage->hasLoggingActive()) {
         return $storage->getLoggingActive();
     }
     $repo = \DMK\Mklog\Factory::getDevlogEntryRepository();
     $config = \DMK\Mklog\Factory::getConfigUtility();
     $storage->setLoggingActive(true);
     if (!$config->getEnableDevLog()) {
         $storage->setLoggingActive(false);
     } elseif (!$repo->isTableAvailable()) {
         // check for exsisting db table
         $storage->setLoggingActive(false);
     }
     return $storage->getLoggingActive();
 }
コード例 #3
0
 /**
  * Test the isLoggingEnabled method
  *
  * @return void
  *
  * @group unit
  * @test
  */
 public function testIsLoggingEnabledWithDisabledLogInGlobals()
 {
     // activate logging
     \DMK\Mklog\Factory::getStorage()->setLoggingActive(true);
     // create an dummy db object for unittests outside of a typo3 env
     $GLOBALS['TYPO3_DB'] = new \stdClass();
     $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['devlog']['nolog'] = true;
     $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['mklog']['nolog'] = true;
     self::assertFalse($this->callInaccessibleMethod($this->getDevlogLoggerMock(), 'isLoggingEnabled'));
     $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['devlog']['nolog'] = false;
     $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['mklog']['nolog'] = false;
     self::assertTrue($this->callInaccessibleMethod($this->getDevlogLoggerMock(), 'isLoggingEnabled'));
 }