/**
  * @since  1.9
  */
 protected function loadAtInstantiation()
 {
     /**
      * Settings object definition
      *
      * @since  1.9
      *
      * @return Settings
      */
     $this->registerObject('Settings', function () {
         return Settings::newFromGlobals();
     }, DependencyObject::SCOPE_SINGLETON);
     /**
      * Store object definition
      *
      * @since  1.9
      *
      * @return Store
      */
     $this->registerObject('Store', function (DependencyBuilder $builder) {
         return StoreFactory::getStore($builder->newObject('Settings')->get('smwgDefaultStore'));
     }, DependencyObject::SCOPE_SINGLETON);
     /**
      * CacheHandler object definition
      *
      * @since  1.9
      *
      * @return CacheHandler
      */
     $this->registerObject('CacheHandler', function (DependencyBuilder $builder) {
         return CacheHandler::newFromId($builder->newObject('Settings')->get('smwgCacheType'));
     }, DependencyObject::SCOPE_SINGLETON);
 }
 /**
  * @since 1.9
  */
 public function testNewFromId()
 {
     CacheHandler::reset();
     $instance = CacheHandler::newFromId('hash');
     $this->assertFalse($instance->isEnabled(), 'Asserts that with no key and valid cacheId, the cache is disabled');
     $instance->setCacheEnabled(true)->setKey(new CacheIdGenerator('lila'));
     $this->assertTrue($instance->isEnabled(), 'Asserts that with an avilable key and valid cacheId, the cache is enabled');
     // Static
     $this->assertTrue($instance === CacheHandler::newFromId('hash'), 'Asserts a static instance');
     $instance->reset();
     $this->assertTrue($instance !== CacheHandler::newFromId('hash'), 'Asserts that the instance have been reset');
     $instance = CacheHandler::newFromId('lula');
     $this->assertFalse($instance->isEnabled(), 'Asserts that with no key and invalid cacheId, the cache is disabled');
     $instance->setCacheEnabled(true)->setKey(new CacheIdGenerator('lila'));
     $this->assertFalse($instance->isEnabled(), 'Asserts that with an available key but invalid cacheId, the cache is disabled');
     $this->assertTrue($instance === CacheHandler::newFromId('lula'), 'Asserts a static instance');
     $instance->reset();
     $this->assertTrue($instance !== CacheHandler::newFromId('lula'), 'Asserts that the instance have been reset');
 }
 /**
  * Returns a CacheHandler instance
  *
  * @since 1.9
  *
  * @return CacheHandler
  */
 public function getCache()
 {
     return CacheHandler::newFromId($this->cacheSetup->get('type'));
 }