protected function setUp()
 {
     parent::setUp();
     $this->applicationFactory = ApplicationFactory::getInstance();
     $settings = Settings::newFromArray(array('smwgShowFactbox' => SMW_FACTBOX_NONEMPTY, 'smwgFactboxUseCache' => true, 'smwgCacheType' => 'hash', 'smwgLinksInValues' => false, 'smwgInlineErrors' => true));
     $this->applicationFactory->registerObject('Settings', $settings);
 }
Example #2
0
 /**
  * @depends testGetPropertyTables
  */
 public function testPropertyTablesWithValidCustomizableProperties()
 {
     $instance = $this->acquireInstance();
     $instance->setConfiguration(Settings::newFromArray(array('smwgFixedProperties' => array(), 'smwgPageSpecialProperties' => array('_MDAT', '_MEDIA'))));
     $this->assertCount($this->defaultPropertyTableCount + 2, $instance->getPropertyTables());
     $instance->clear();
 }
 protected function setUp()
 {
     parent::setUp();
     $this->applicationFactory = ApplicationFactory::getInstance();
     $settings = Settings::newFromArray(array('smwgFactboxUseCache' => true, 'smwgCacheType' => 'hash'));
     $this->applicationFactory->registerObject('Settings', $settings);
 }
 protected function setUp()
 {
     parent::setUp();
     $this->store = $this->getMockBuilder('\\SMW\\Store')->disableOriginalConstructor()->getMockForAbstractClass();
     $this->skin = $this->getMockBuilder('\\Skin')->disableOriginalConstructor()->getMock();
     $this->settings = Settings::newFromArray(array());
     $this->dataItemFactory = new DataItemFactory();
 }
 protected function setUp()
 {
     parent::setUp();
     $this->store = $this->getMockBuilder('\\SMW\\Store')->disableOriginalConstructor()->getMockForAbstractClass();
     $this->skin = $this->getMockBuilder('\\Skin')->disableOriginalConstructor()->getMock();
     $this->settings = Settings::newFromArray(array('smwgPDefaultType' => '_wpg', 'smwgPropertyLowUsageThreshold' => 5, 'smwgPropertyZeroCountDisplay' => true));
     $this->dataItemFactory = new DataItemFactory();
 }
 protected function setUp()
 {
     parent::setUp();
     $this->applicationFactory = ApplicationFactory::getInstance();
     $settings = Settings::newFromArray(array('smwgFactboxUseCache' => true, 'smwgCacheType' => 'hash', 'smwgLinksInValues' => false, 'smwgInlineErrors' => true));
     $this->applicationFactory->registerObject('Settings', $settings);
     $this->cache = $this->applicationFactory->newCacheFactory()->newFixedInMemoryCache();
     $this->applicationFactory->registerObject('Cache', $this->cache);
 }
 protected function setUp()
 {
     parent::setUp();
     $this->applicationFactory = ApplicationFactory::getInstance();
     $settings = Settings::newFromArray(array('smwgCacheType' => 'hash', 'smwgEnableUpdateJobs' => false));
     $store = $this->getMockBuilder('\\SMW\\Store')->disableOriginalConstructor()->getMockForAbstractClass();
     $this->applicationFactory->registerObject('Store', $store);
     $this->applicationFactory->registerObject('Settings', $settings);
 }
 /**
  * @dataProvider skinTemplateDataProvider
  */
 public function testProcess($setup, $expected)
 {
     $toolbox = '';
     ApplicationFactory::getInstance()->registerObject('Settings', Settings::newFromArray($setup['settings']));
     $instance = new BaseTemplateToolbox($setup['skinTemplate'], $toolbox);
     $this->assertTrue($instance->process());
     if ($expected['count'] == 0) {
         return $this->assertEmpty($toolbox);
     }
     $this->assertCount($expected['count'], $toolbox['smw-browse']);
 }
 /**
  * @dataProvider wikiPageDataProvider
  */
 public function testProcess($parameters, $expected)
 {
     $this->applicationFactory->registerObject('Settings', Settings::newFromArray($parameters['settings']));
     $instance = new NewRevisionFromEditComplete($parameters['wikiPage'], $parameters['revision'], 0);
     $this->assertTrue($instance->process());
     $editInfo = $parameters['editInfo'];
     if ($editInfo && $editInfo->output instanceof ParserOutput) {
         $parserData = $this->applicationFactory->newParserData($parameters['wikiPage']->getTitle(), $editInfo->output);
         $this->semanticDataValidator->assertThatPropertiesAreSet($expected, $parserData->getSemanticData());
     }
 }
 public function testDeleteSubjectForNotSupportedSemanticNamespace()
 {
     $oldTitle = \Title::newFromText('Old');
     $newTitle = \Title::newFromText('New', NS_HELP);
     $store = $this->getMockBuilder('\\SMW\\Store')->disableOriginalConstructor()->getMockForAbstractClass();
     $store->expects($this->once())->method('deleteSubject')->with($this->equalTo($oldTitle));
     $this->applicationFactory->registerObject('Settings', Settings::newFromArray(array('smwgCacheType' => 'hash', 'smwgAutoRefreshOnPageMove' => true, 'smwgNamespacesWithSemanticLinks' => array(NS_MAIN => true, NS_HELP => false))));
     $this->applicationFactory->registerObject('Store', $store);
     $instance = new TitleMoveComplete($oldTitle, $newTitle, new MockSuperUser(), 0, 0);
     $this->assertTrue($instance->process());
 }
Example #11
0
 public function testProcess()
 {
     $oldTitle = MockTitle::buildMock('old');
     $newTitle = MockTitle::buildMock('new');
     $store = $this->getMockBuilder('\\SMW\\Store')->disableOriginalConstructor()->getMockForAbstractClass();
     $store->expects($this->once())->method('changeTitle')->with($this->equalTo($oldTitle), $this->equalTo($newTitle), $this->anything(), $this->anything());
     $this->applicationFactory->registerObject('Settings', Settings::newFromArray(array('smwgCacheType' => 'hash', 'smwgAutoRefreshOnPageMove' => true)));
     $this->applicationFactory->registerObject('Store', $store);
     $instance = new TitleMoveComplete($oldTitle, $newTitle, new MockSuperUser(), 0, 0);
     $this->assertTrue($instance->process());
 }
 /**
  * @dataProvider annotationDataProvider
  */
 public function testChainableDecoratorAnnotation(array $parameters, array $expected)
 {
     $pageInfoProvider = $this->getMockBuilder('\\SMW\\PageInfo')->disableOriginalConstructor()->getMock();
     $pageInfoProvider->expects($this->atLeastOnce())->method('getModificationDate')->will($this->returnValue($parameters['modificationDate']));
     $semanticData = $this->semanticDataFactory->newEmptySemanticData(__METHOD__);
     $this->applicationFactory->registerObject('Settings', Settings::newFromArray($parameters['settings']));
     $instance = new CategoryPropertyAnnotator(new NullPropertyAnnotator($semanticData), $parameters['categories']);
     $instance = new SortKeyPropertyAnnotator($instance, $parameters['sortkey']);
     $instance = new PredefinedPropertyAnnotator($instance, $pageInfoProvider);
     $instance->addAnnotation();
     $this->semanticDataValidator->assertThatPropertiesAreSet($expected, $instance->getSemanticData());
 }
 /**
  * @dataProvider textDataProvider
  */
 public function testTextChangeWithParserOuputUpdateIntegration($parameters, $expected)
 {
     $text = $parameters['text'];
     $parser = $this->parserFactory->newFromTitle($parameters['title']);
     $instance = new InternalParseBeforeLinks($parser, $text);
     $this->applicationFactory->registerObject('Settings', Settings::newFromArray($parameters['settings']));
     $this->assertTrue($instance->process());
     $this->assertEquals($expected['resultText'], $text);
     $parserData = $this->applicationFactory->newParserData($parser->getTitle(), $parser->getOutput());
     $this->assertEquals($expected['propertyCount'] > 0, $parser->getOutput()->getProperty('smw-semanticdata-status'));
     $this->semanticDataValidator->assertThatPropertiesAreSet($expected, $parserData->getSemanticData());
 }
 /**
  * @dataProvider specialPropertiesDataProvider
  */
 public function testAddSpecialProperties(array $parameters, array $expected)
 {
     $semanticData = $this->semanticDataFactory->setSubject($parameters['subject'])->newEmptySemanticData();
     $pageInfo = $this->getMockBuilder('\\SMW\\PageInfo')->disableOriginalConstructor()->getMock();
     foreach ($parameters['pageInfo'] as $method => $returnValue) {
         $pageInfo->expects($this->any())->method($method)->will($this->returnValue($returnValue));
     }
     $this->applicationFactory->registerObject('Settings', Settings::newFromArray($parameters['settings']));
     $instance = new PredefinedPropertyAnnotator(new NullPropertyAnnotator($semanticData), $pageInfo);
     $instance->addAnnotation();
     $this->semanticDataValidator->assertThatPropertiesAreSet($expected, $instance->getSemanticData());
 }
 /**
  * @dataProvider hiddenCategoriesDataProvider
  */
 public function testAddCategoriesWithHiddenCategories(array $parameters, array $expected)
 {
     $expectedPageLookup = $parameters['settings']['smwgShowHiddenCategories'] ? $this->never() : $this->atLeastOnce();
     $wikiPage = $this->getMockBuilder('\\WikiPage')->disableOriginalConstructor()->getMock();
     $wikiPage->expects($expectedPageLookup)->method('getHiddenCategories')->will($this->returnValue($parameters['hidCategories']));
     $pageCreator = $this->getMockBuilder('\\SMW\\MediaWiki\\PageCreator')->disableOriginalConstructor()->getMock();
     $pageCreator->expects($expectedPageLookup)->method('createPage')->will($this->returnValue($wikiPage));
     $semanticData = $this->semanticDataFactory->setSubject(new DIWikiPage(__METHOD__, $parameters['namespace'], ''))->newEmptySemanticData();
     $this->applicationFactory->registerObject('Settings', Settings::newFromArray($parameters['settings']));
     $this->applicationFactory->registerObject('PageCreator', $pageCreator);
     $instance = new CategoryPropertyAnnotator(new NullPropertyAnnotator($semanticData), $parameters['categories']);
     $instance->addAnnotation();
     $this->semanticDataValidator->assertThatPropertiesAreSet($expected, $semanticData);
 }
 protected function setUp()
 {
     parent::setUp();
     $this->testEnvironment = new TestEnvironment();
     $this->store = $this->getMockBuilder('\\SMW\\Store')->disableOriginalConstructor()->getMockForAbstractClass();
     $this->skin = $this->getMockBuilder('\\Skin')->disableOriginalConstructor()->getMock();
     $container = $this->getMockBuilder('\\Onoi\\BlobStore\\Container')->disableOriginalConstructor()->getMock();
     $blobStore = $this->getMockBuilder('\\Onoi\\BlobStore\\BlobStore')->disableOriginalConstructor()->getMock();
     $blobStore->expects($this->any())->method('read')->will($this->returnValue($container));
     $cachedPropertyValuesPrefetcher = $this->getMockBuilder('\\SMW\\CachedPropertyValuesPrefetcher')->setConstructorArgs(array($this->store, $blobStore))->setMethods(null)->getMock();
     $this->testEnvironment->registerObject('CachedPropertyValuesPrefetcher', $cachedPropertyValuesPrefetcher);
     $this->settings = Settings::newFromArray(array());
     $this->dataItemFactory = new DataItemFactory();
 }
 /**
  * @dataProvider templateDataProvider
  */
 public function testPreprocessTemplateAndParse($namespace, array $settings, $text, $tmplValue, array $expected)
 {
     $parserOutput = new ParserOutput();
     $title = Title::newFromText(__METHOD__, $namespace);
     $outputText = $this->runTemplateTransclusion($title, $text, $tmplValue);
     $this->applicationFactory->registerObject('Settings', Settings::newFromArray($settings));
     $parserData = new ParserData($title, $parserOutput);
     $instance = new InTextAnnotationParser($parserData, new MagicWordsFinder(), new RedirectTargetFinder());
     $instance->parse($outputText);
     $this->assertContains($expected['resultText'], $outputText);
     $parserData = new ParserData($title, $parserOutput);
     $this->assertInstanceOf('\\SMW\\SemanticData', $parserData->getSemanticData());
     $this->semanticDataValidator->assertThatPropertiesAreSet($expected, $parserData->getSemanticData());
 }
 public function testSemanticDataParserOuputUpdateIntegration()
 {
     $settings = Settings::newFromArray(array('smwgCacheType' => 'hash', 'smwgEnableUpdateJobs' => false, 'smwgUseCategoryHierarchy' => false, 'smwgCategoriesAsInstances' => true, 'smwgShowHiddenCategories' => true));
     $this->applicationFactory->registerObject('Settings', $settings);
     $text = '';
     $title = Title::newFromText(__METHOD__);
     $parser = $this->parserFactory->newFromTitle($title);
     $parser->getOutput()->addCategory('Foo', 'Foo');
     $parser->getOutput()->addCategory('Bar', 'Bar');
     $parser->getOutput()->setProperty('smw-semanticdata-status', true);
     $instance = new ParserAfterTidy($parser, $text);
     $this->assertTrue($instance->process());
     $expected = array('propertyCount' => 2, 'propertyKeys' => array('_INST', '_SKEY'), 'propertyValues' => array('Foo', 'Bar', $title->getText()));
     $parserData = $this->applicationFactory->newParserData($title, $parser->getOutput());
     $this->semanticDataValidator->assertThatPropertiesAreSet($expected, $parserData->getSemanticData());
 }
 /**
  * @since 1.9
  *
  * @return PropertiesCollector
  */
 private function newInstance($smwTitle = 'Foo', $usageCount = 1, $cacheEnabled = false)
 {
     $id = 9999;
     $row = new \stdClass();
     $row->p_id = (string) $id;
     // PropertyStatisticsTable assert ctype_digit
     $row->usage_count = (string) $usageCount;
     // PropertyStatisticsTable assert ctype_digit
     $idTable = $this->getMockBuilder('\\stdClass')->setMethods(array('getIdTable'))->getMock();
     $idTable->expects($this->any())->method('getIdTable')->will($this->returnValue('foo'));
     $database = $this->getMockBuilder('\\SMW\\MediaWiki\\Database')->disableOriginalConstructor()->getMock();
     $database->expects($this->any())->method('select')->will($this->returnValue(array($row)));
     $store = $this->getMockBuilder('\\SMWSQLStore3')->disableOriginalConstructor()->setMethods(array('getConnection', 'getObjectIds'))->getMock();
     $store->expects($this->any())->method('getConnection')->will($this->returnValue($database));
     $store->expects($this->any())->method('getObjectIds')->will($this->returnValue($idTable));
     $connection = $this->getMockDBConnection($smwTitle, $id, $usageCount);
     $settings = Settings::newFromArray(array('smwgCacheType' => 'hash', 'smwgPropertiesCache' => $cacheEnabled, 'smwgPropertiesCacheExpiry' => 360));
     return new PropertiesCollector($store, $connection, $settings);
 }
 /**
  * @return DeleteSubjectJob
  */
 private function acquireInstance(Title $title = null, $settings = array())
 {
     if ($title === null) {
         $title = Title::newFromText(__METHOD__);
     }
     $defaultSettings = array('smwgCacheType' => 'hash', 'smwgEnableUpdateJobs' => false, 'smwgDeleteSubjectAsDeferredJob' => false, 'smwgDeleteSubjectWithAssociatesRefresh' => false);
     $settings = Settings::newFromArray(array_merge($defaultSettings, $settings));
     $semanticData = new SemanticData(DIWikiPage::newFromTitle($title));
     $mockStore = $this->getMockBuilder('\\SMW\\Store')->disableOriginalConstructor()->setMethods(array('deleteSubject', 'getSemanticData', 'getProperties', 'getInProperties'))->getMockForAbstractClass();
     $mockStore->expects($this->once())->method('deleteSubject')->will($this->returnCallback(array($this, 'mockStoreDeleteSubjectCallback')));
     $mockStore->expects($this->any())->method('getSemanticData')->will($this->returnValue($semanticData));
     $mockStore->expects($this->any())->method('getProperties')->will($this->returnValue(array()));
     $mockStore->expects($this->any())->method('getInProperties')->will($this->returnValue(array()));
     ApplicationFactory::getInstance()->registerObject('Store', $mockStore);
     ApplicationFactory::getInstance()->registerObject('Settings', $settings);
     $parameters = array('asDeferredJob' => $settings->get('smwgDeleteSubjectAsDeferredJob'), 'withAssociates' => $settings->get('smwgDeleteSubjectWithAssociatesRefresh'));
     $instance = new DeleteSubjectJob($title, $parameters);
     $instance->setJobQueueEnabledState(false);
     return $instance;
 }
Example #21
0
 /**
  * @dataProvider titleDataProvider
  */
 public function testProcess($setup, $expected)
 {
     $wikiPage = new WikiPage($setup['title']);
     $pageId = $wikiPage->getTitle()->getArticleID();
     ApplicationFactory::getInstance()->registerObject('Settings', Settings::newFromArray(array('smwgCacheType' => 'hash', 'smwgAutoRefreshOnPurge' => $setup['smwgAutoRefreshOnPurge'], 'smwgFactboxCacheRefreshOnPurge' => $setup['smwgFactboxCacheRefreshOnPurge'])));
     $instance = new ArticlePurge($wikiPage);
     $cache = ApplicationFactory::getInstance()->getCache();
     $id = FactboxCache::newCacheId($pageId);
     //	$cache->setKey( $id )->set( true );
     $this->assertEquals($expected['autorefreshPreProcess'], $cache->setKey($instance->newCacheId($pageId))->get(), 'Asserts the autorefresh cache status before processing');
     // Travis 210.5, 305.3
     $travis = $cache->setKey($id)->get();
     $travisText = json_encode($travis);
     $this->assertEquals($expected['factboxPreProcess'], $travis, "Asserts the factbox cache status before processing, {$travisText}");
     $this->assertFalse($cache->setKey($instance->newCacheId($pageId))->get(), 'Asserts that before processing ...');
     $result = $instance->process();
     // Post-process check
     $this->assertTrue($result, 'Asserts that process() always returns true');
     $this->assertEquals($expected['autorefreshPostProcess'], $cache->setKey($instance->newCacheId($pageId))->get(), 'Asserts the autorefresh cache status after processing');
     $this->assertEquals($expected['factboxPostProcess'], $cache->setCacheEnabled(true)->setKey($id)->get(), 'Asserts the factbox cache status after processing');
 }
 /**
  * @dataProvider dataItemDataProvider
  */
 public function testDetectChanges($storeValues, $dataValues, $settings, $expected)
 {
     $this->storeValues = $storeValues;
     $subject = DIWikiPage::newFromTitle(Title::newFromText(__METHOD__, SMW_NS_PROPERTY));
     $settings = Settings::newFromArray(array('smwgDeclarationProperties' => $settings));
     $this->applicationFactory->registerObject('Settings', $settings);
     $updateDispatcherJob = $this->getMockBuilder('SMW\\MediaWiki\\Jobs\\UpdateDispatcherJob')->disableOriginalConstructor()->getMock();
     $expectedToRun = $expected['job'] ? $this->once() : $this->never();
     $updateDispatcherJob->expects($expectedToRun)->method('run')->will($this->returnValue($subject));
     $jobFactory = $this->getMockBuilder('SMW\\MediaWiki\\Jobs\\JobFactory')->disableOriginalConstructor()->getMock();
     $jobFactory->expects($this->any())->method('newUpdateDispatcherJob')->will($this->returnValue($updateDispatcherJob));
     $this->applicationFactory->registerObject('JobFactory', $jobFactory);
     $store = $this->getMockBuilder('SMW\\Store')->disableOriginalConstructor()->setMethods(array('getPropertyValues'))->getMockForAbstractClass();
     $store->expects($this->atLeastOnce())->method('getPropertyValues')->will($this->returnCallback(array($this, 'mockStorePropertyValuesCallback')));
     $semanticData = $this->getMockBuilder('\\SMW\\SemanticData')->disableOriginalConstructor()->getMock();
     $semanticData->expects($this->atLeastOnce())->method('getSubject')->will($this->returnValue($subject));
     $semanticData->expects($this->atLeastOnce())->method('getPropertyValues')->will($this->returnValue($dataValues));
     $instance = new PropertyTypeDiffFinder($store, $semanticData);
     $instance->findDiff();
     $this->assertEquals($subject->getTitle(), $instance->getTitle());
     $this->assertEquals($expected['diff'], $instance->hasDiff());
 }
Example #23
0
 /**
  * @dataProvider textDataProvider
  */
 public function testGetMagicWords($text, array $expected)
 {
     $title = Title::newFromText(__METHOD__);
     $settings = Settings::newFromArray(array('smwgShowFactboxEdit' => SMW_FACTBOX_HIDDEN, 'smwgShowFactbox' => SMW_FACTBOX_HIDDEN));
     $this->applicationFactory->registerObject('Settings', $settings);
     $parserOutput = $this->getMockBuilder('\\ParserOutput')->disableOriginalConstructor()->getMock();
     $parserOutput->expects($this->any())->method('getExtensionData')->will($this->returnValue($expected['magicWords']));
     // MW 1.19, 1.20
     $parserOutput->mSMWMagicWords = $expected['magicWords'];
     $store = $this->getMockBuilder('\\SMW\\Store')->disableOriginalConstructor()->getMockForAbstractClass();
     $messageBuilder = $this->getMockBuilder('\\SMW\\MediaWiki\\MessageBuilder')->disableOriginalConstructor()->getMock();
     $instance = new Factbox($store, new ParserData($title, $parserOutput), $messageBuilder);
     if (isset($expected['preview']) && $expected['preview']) {
         $instance->useInPreview(true);
     }
     $reflector = new ReflectionClass('\\SMW\\Factbox');
     $magic = $reflector->getMethod('getMagicWords');
     $magic->setAccessible(true);
     $result = $magic->invoke($instance);
     $this->assertInternalType('integer', $result);
     $this->assertEquals($expected['constants'], $result);
 }
 /**
  * @return RecurringEventsParserFunction
  */
 private function acquireInstance(Title $title, ParserOutput $parserOutput)
 {
     $settings = array('smwgDefaultNumRecurringEvents' => 100, 'smwgMaxNumRecurringEvents' => 100);
     return new RecurringEventsParserFunction(new ParserData($title, $parserOutput), new Subobject($title), new MessageFormatter(\Language::factory('en')), Settings::newFromArray($settings));
 }
 /**
  * @since 1.9
  *
  * @return Settings
  */
 private function newInstance(array $settings)
 {
     return Settings::newFromArray($settings);
 }
 public function testFormatResultOnNonUserDefinedProperty()
 {
     $store = $this->getMockBuilder('\\SMW\\Store')->disableOriginalConstructor()->getMockForAbstractClass();
     $skin = $this->getMockBuilder('\\Skin')->disableOriginalConstructor()->getMock();
     $setttings = Settings::newFromArray(array());
     $instance = new WantedPropertiesQueryPage($store, $setttings);
     $result = $instance->formatResult($skin, array('foo', 0));
     $this->assertInternalType('string', $result);
     $this->assertEmpty($result);
 }
 /**
  * Helper method that returns a Settings object
  *
  * @since 1.9
  *
  * @param array $settings
  *
  * @return Settings
  */
 protected function newSettings(array $settings = array())
 {
     return Settings::newFromArray($settings);
 }
 public function testRedirectAnnotationFromInjectedRedirectTarget()
 {
     $namespace = NS_MAIN;
     $text = '';
     $redirectTarget = Title::newFromText('Foo');
     $expected = array('propertyCount' => 1, 'property' => new DIProperty('_REDI'), 'propertyValues' => array('Foo'));
     $settings = array('smwgNamespacesWithSemanticLinks' => array($namespace => true), 'smwgLinksInValues' => false, 'smwgInlineErrors' => true);
     $this->testEnvironment->registerObject('Settings', Settings::newFromArray($settings));
     $parserData = new ParserData(Title::newFromText(__METHOD__, $namespace), new ParserOutput());
     $redirectTargetFinder = new RedirectTargetFinder();
     $instance = new InTextAnnotationParser($parserData, new MagicWordsFinder(), $redirectTargetFinder);
     $instance->setRedirectTarget($redirectTarget);
     $instance->parse($text);
     $this->semanticDataValidator->assertThatPropertiesAreSet($expected, $parserData->getSemanticData());
 }
 public function testUnknownPredefinedPropertyThrowsExceptionToReturnErrorDataItem()
 {
     $tableDefinition = $this->getMockBuilder('\\stdClass')->setMethods(array('isFixedPropertyTable', 'getName'))->getMock();
     $tableDefinition->expects($this->once())->method('isFixedPropertyTable')->will($this->returnValue(false));
     $tableDefinition->expects($this->once())->method('getName')->will($this->returnValue('Bar'));
     $store = $this->getMockBuilder('\\SMWSQLStore3')->setMethods(array('getPropertyTables', 'findTypeTableId'))->getMock();
     $store->expects($this->once())->method('getPropertyTables')->will($this->returnValue(array('Foo' => $tableDefinition)));
     $store->expects($this->atLeastOnce())->method('findTypeTableId')->will($this->returnValue('Foo'));
     $row = new \stdClass();
     $row->smw_title = '_UnknownPredefinedProperty';
     $row->count = 0;
     $dbConnection = $this->getMockBuilder('\\DatabaseBase')->disableOriginalConstructor()->setMethods(array('select'))->getMockForAbstractClass();
     $dbConnection->expects($this->once())->method('select')->will($this->returnValue(array($row)));
     $settings = Settings::newFromArray(array('smwgPDefaultType' => 'Foo'));
     $instance = new WantedPropertiesCollector($store, $dbConnection, $settings);
     $results = $instance->runCollector();
     $this->assertInternalType('array', $results);
     $this->assertInstanceOf('SMWDIError', $results[0][0]);
 }