/** * @since 2.4 * * @param Store $store * * @return QueryDependencyLinksStore */ public function newQueryDependencyLinksStore($store) { $queryDependencyLinksStore = new QueryDependencyLinksStore($this->newQueryResultDependencyListResolver(), new DependencyLinksTableUpdater($store)); $queryDependencyLinksStore->setEnabled(ApplicationFactory::getInstance()->getSettings()->get('smwgEnabledQueryDependencyLinksStore')); $queryDependencyLinksStore->isCommandLineMode($GLOBALS['wgCommandLineMode']); return $queryDependencyLinksStore; }
public function testTryDoUpdateDependenciesByWithinSkewedTime() { $title = $this->getMockBuilder('\\Title')->disableOriginalConstructor()->getMock(); $title->expects($this->once())->method('getTouched')->will($this->returnValue(wfTimestamp(TS_MW) + 60)); $subject = $this->getMockBuilder('\\SMW\\DIWikiPage')->disableOriginalConstructor()->getMock(); $subject->expects($this->once())->method('getHash')->will($this->returnValue('Foo###')); $subject->expects($this->once())->method('getTitle')->will($this->returnValue($title)); $connection = $this->getMockBuilder('\\SMW\\MediaWiki\\Database')->disableOriginalConstructor()->getMock(); $connectionManager = $this->getMockBuilder('\\SMW\\ConnectionManager')->disableOriginalConstructor()->getMock(); $connectionManager->expects($this->any())->method('getConnection')->will($this->returnValue($connection)); $store = $this->getMockBuilder('\\SMW\\SQLStore\\SQLStore')->disableOriginalConstructor()->getMockForAbstractClass(); $store->setConnectionManager($connectionManager); $queryResultDependencyListResolver = $this->getMockBuilder('\\SMW\\SQLStore\\QueryDependency\\QueryResultDependencyListResolver')->disableOriginalConstructor()->getMock(); $queryResultDependencyListResolver->expects($this->any())->method('getDependencyListByLateRetrievalFrom')->will($this->returnValue(array())); $dependencyLinksTableUpdater = $this->getMockBuilder('\\SMW\\SQLStore\\QueryDependency\\DependencyLinksTableUpdater')->disableOriginalConstructor()->getMock(); $dependencyLinksTableUpdater->expects($this->any())->method('getId')->will($this->returnValue(4)); $dependencyLinksTableUpdater->expects($this->any())->method('getStore')->will($this->returnValue($store)); $instance = new QueryDependencyLinksStore($queryResultDependencyListResolver, $dependencyLinksTableUpdater); $query = $this->getMockBuilder('\\SMWQuery')->disableOriginalConstructor()->getMock(); $query->expects($this->any())->method('getContextPage')->will($this->returnValue($subject)); $query->expects($this->any())->method('getLimit')->will($this->returnValue(1)); $queryResult = $this->getMockBuilder('\\SMWQueryResult')->disableOriginalConstructor()->getMock(); $queryResult->expects($this->any())->method('getQuery')->will($this->returnValue($query)); $instance->doUpdateDependenciesFrom($queryResult); }