protected function tearDown()
 {
     ApplicationFactory::clear();
     NamespaceExaminer::clear();
     PropertyRegistry::clear();
     Settings::clear();
     Exporter::getInstance()->clear();
     parent::tearDown();
 }
 protected function tearDown()
 {
     // If setUp is skipped early this might not be initialized
     if ($this->testEnvironment !== null) {
         $this->testEnvironment->tearDown();
     }
     ApplicationFactory::clear();
     NamespaceExaminer::clear();
     PropertyRegistry::clear();
     Settings::clear();
     Exporter::getInstance()->clear();
     parent::tearDown();
 }
 private function registerCallbackHandlers($callbackLoader)
 {
     $callbackLoader->registerExpectedReturnType('Settings', '\\SMW\\Settings');
     $callbackLoader->registerCallback('Settings', function () use($callbackLoader) {
         return Settings::newFromGlobals();
     });
     $callbackLoader->registerExpectedReturnType('Store', '\\SMW\\Store');
     $callbackLoader->registerCallback('Store', function () use($callbackLoader) {
         return StoreFactory::getStore($callbackLoader->singleton('Settings')->get('smwgDefaultStore'));
     });
     $callbackLoader->registerExpectedReturnType('Cache', '\\Onoi\\Cache\\Cache');
     $callbackLoader->registerCallback('Cache', function () {
         return ApplicationFactory::getInstance()->newCacheFactory()->newMediaWikiCompositeCache();
     });
     $callbackLoader->registerCallback('NamespaceExaminer', function () use($callbackLoader) {
         return NamespaceExaminer::newFromArray($callbackLoader->singleton('Settings')->get('smwgNamespacesWithSemanticLinks'));
     });
     $callbackLoader->registerExpectedReturnType('ParserData', '\\SMW\\ParserData');
     $callbackLoader->registerCallback('ParserData', function (\Title $title, \ParserOutput $parserOutput) {
         return new ParserData($title, $parserOutput);
     });
     $callbackLoader->registerCallback('MessageFormatter', function (\Language $language) {
         return new MessageFormatter($language);
     });
     $callbackLoader->registerExpectedReturnType('PageCreator', '\\SMW\\MediaWiki\\PageCreator');
     $callbackLoader->registerCallback('PageCreator', function () {
         return new PageCreator();
     });
     $callbackLoader->registerExpectedReturnType('TitleCreator', '\\SMW\\MediaWiki\\TitleCreator');
     $callbackLoader->registerCallback('TitleCreator', function () {
         return new TitleCreator();
     });
     $callbackLoader->registerExpectedReturnType('WikiPage', '\\WikiPage');
     $callbackLoader->registerCallback('WikiPage', function (\Title $title) {
         return \WikiPage::factory($title);
     });
     $callbackLoader->registerExpectedReturnType('ContentParser', '\\SMW\\ContentParser');
     $callbackLoader->registerCallback('ContentParser', function (\Title $title) {
         return new ContentParser($title);
     });
     $callbackLoader->registerExpectedReturnType('JobFactory', '\\SMW\\MediaWiki\\Jobs\\JobFactory');
     $callbackLoader->registerCallback('JobFactory', function () {
         return new JobFactory();
     });
     $callbackLoader->registerExpectedReturnType('FactboxFactory', '\\SMW\\Factbox\\FactboxFactory');
     $callbackLoader->registerCallback('FactboxFactory', function () {
         return new FactboxFactory();
     });
 }
 public function testNewFromArray()
 {
     $instance = NamespaceExaminer::newFromArray(array(NS_MAIN => true));
     $this->assertTrue($instance->isSemanticEnabled(NS_MAIN));
 }
Esempio n. 5
0
 /**
  * @since 2.1
  *
  * @return NamespaceExaminer
  */
 public function getNamespaceExaminer()
 {
     return NamespaceExaminer::newFromArray($this->getSettings()->get('smwgNamespacesWithSemanticLinks'));
 }
 private function registerCallbackHandlers($callbackLoader)
 {
     $callbackLoader->registerExpectedReturnType('Settings', '\\SMW\\Settings');
     $callbackLoader->registerCallback('Settings', function () use($callbackLoader) {
         return Settings::newFromGlobals();
     });
     $callbackLoader->registerExpectedReturnType('Store', '\\SMW\\Store');
     $callbackLoader->registerCallback('Store', function ($store = null) use($callbackLoader) {
         return StoreFactory::getStore($store !== null ? $store : $callbackLoader->singleton('Settings')->get('smwgDefaultStore'));
     });
     $callbackLoader->registerExpectedReturnType('Cache', '\\Onoi\\Cache\\Cache');
     $callbackLoader->registerCallback('Cache', function ($cacheType = null) use($callbackLoader) {
         return $callbackLoader->load('CacheFactory')->newMediaWikiCompositeCache($cacheType);
     });
     $callbackLoader->registerCallback('NamespaceExaminer', function () use($callbackLoader) {
         return NamespaceExaminer::newFromArray($callbackLoader->singleton('Settings')->get('smwgNamespacesWithSemanticLinks'));
     });
     $callbackLoader->registerExpectedReturnType('ParserData', '\\SMW\\ParserData');
     $callbackLoader->registerCallback('ParserData', function (\Title $title, \ParserOutput $parserOutput) {
         return new ParserData($title, $parserOutput);
     });
     $callbackLoader->registerCallback('MessageFormatter', function (\Language $language) {
         return new MessageFormatter($language);
     });
     $callbackLoader->registerCallback('MediaWikiNsContentReader', function () use($callbackLoader) {
         $callbackLoader->registerExpectedReturnType('MediaWikiNsContentReader', '\\SMW\\MediaWiki\\MediaWikiNsContentReader');
         return new MediaWikiNsContentReader();
     });
     $callbackLoader->registerExpectedReturnType('PageCreator', '\\SMW\\MediaWiki\\PageCreator');
     $callbackLoader->registerCallback('PageCreator', function () {
         return new PageCreator();
     });
     $callbackLoader->registerCallback('JobQueueLookup', function (Database $connection) use($callbackLoader) {
         $callbackLoader->registerExpectedReturnType('JobQueueLookup', '\\SMW\\MediaWiki\\JobQueueLookup');
         return new JobQueueLookup($connection);
     });
     $callbackLoader->registerCallback('ManualEntryLogger', function () use($callbackLoader) {
         $callbackLoader->registerExpectedReturnType('ManualEntryLogger', '\\SMW\\MediaWiki\\ManualEntryLogger');
         return new ManualEntryLogger();
     });
     $callbackLoader->registerExpectedReturnType('TitleCreator', '\\SMW\\MediaWiki\\TitleCreator');
     $callbackLoader->registerCallback('TitleCreator', function () {
         return new TitleCreator();
     });
     $callbackLoader->registerExpectedReturnType('ContentParser', '\\SMW\\ContentParser');
     $callbackLoader->registerCallback('ContentParser', function (\Title $title) {
         return new ContentParser($title);
     });
     $callbackLoader->registerExpectedReturnType('DeferredCallableUpdate', '\\SMW\\DeferredCallableUpdate');
     $callbackLoader->registerCallback('DeferredCallableUpdate', function (\Closure $callback) {
         return new DeferredCallableUpdate($callback);
     });
     /**
      * @var InMemoryPoolCache
      */
     $callbackLoader->registerCallback('InMemoryPoolCache', function () use($callbackLoader) {
         $callbackLoader->registerExpectedReturnType('InMemoryPoolCache', '\\SMW\\InMemoryPoolCache');
         return InMemoryPoolCache::getInstance();
     });
     /**
      * @var PropertyAnnotatorFactory
      */
     $callbackLoader->registerCallback('PropertyAnnotatorFactory', function () use($callbackLoader) {
         $callbackLoader->registerExpectedReturnType('PropertyAnnotatorFactory', '\\SMW\\PropertyAnnotatorFactory');
         return new PropertyAnnotatorFactory();
     });
 }
 private function isEnabledNamespace(Title $title)
 {
     return NamespaceExaminer::newFromArray(ApplicationFactory::getInstance()->getSettings()->get('smwgNamespacesWithSemanticLinks'))->isSemanticEnabled($title->getNamespace());
 }
/**
 * @see NamespaceExaminer
 *
 * @return boolean
 * @deprecated since 1.9 and will be removed in 1.11
 */
function smwfIsSemanticsProcessed($namespace)
{
    return \SMW\NamespaceExaminer::getInstance()->isSemanticEnabled($namespace);
}
 /**
  * NamespaceExaminer object definition
  *
  * @since  1.9
  *
  * @return NamespaceExaminer
  */
 protected function getNamespaceExaminer()
 {
     return function (DependencyBuilder $builder) {
         return NamespaceExaminer::newFromArray($builder->newObject('Settings')->get('smwgNamespacesWithSemanticLinks'));
     };
 }