protected function setUp() { parent::setUp(); $this->dataValueFactory = DataValueFactory::getInstance(); $this->queryResultValidator = UtilityFactory::getInstance()->newValidatorFactory()->newQueryResultValidator(); $this->semanticDataFactory = UtilityFactory::getInstance()->newSemanticDataFactory(); }
protected function setUp() { parent::setUp(); $utilityFactory = UtilityFactory::getInstance(); $this->fixturesFileProvider = $utilityFactory->newFixturesFactory()->newFixturesFileProvider(); $this->semanticDataValidator = $utilityFactory->newValidatorFactory()->newSemanticDataValidator(); $this->pageEditor = $utilityFactory->newPageEditor(); $this->mwHooksHandler = $utilityFactory->newMwHooksHandler(); $this->mwHooksHandler->deregisterListedHooks(); $this->applicationFactory = ApplicationFactory::getInstance(); $settings = array('smwgPageSpecialProperties' => array('_MEDIA', '_MIME'), 'smwgNamespacesWithSemanticLinks' => array(NS_MAIN => true, NS_FILE => true), 'smwgCacheType' => 'hash'); foreach ($settings as $key => $value) { $this->applicationFactory->getSettings()->set($key, $value); } // $this->getStore()->clear(); // $this->getStore()->setupStore( false ); $this->wgEnableUploads = $GLOBALS['wgEnableUploads']; $this->wgFileExtensions = $GLOBALS['wgFileExtensions']; $this->wgVerifyMimeType = $GLOBALS['wgVerifyMimeType']; $this->mwHooksHandler->register('FileUpload', $this->mwHooksHandler->getHookRegistry()->getHandlerFor('FileUpload')); $this->mwHooksHandler->register('InternalParseBeforeLinks', $this->mwHooksHandler->getHookRegistry()->getHandlerFor('InternalParseBeforeLinks')); $this->mwHooksHandler->register('LinksUpdateConstructed', $this->mwHooksHandler->getHookRegistry()->getHandlerFor('LinksUpdateConstructed')); $GLOBALS['wgEnableUploads'] = true; $GLOBALS['wgFileExtensions'] = array('txt'); $GLOBALS['wgVerifyMimeType'] = true; }
protected function tearDown() { ApplicationFactory::getInstance()->clear(); $pageDeleter = UtilityFactory::getInstance()->newPageDeleter(); $pageDeleter->doDeletePoolOfPages($this->importedTitles); parent::tearDown(); }
protected function setUp() { parent::setUp(); $this->mwHooksHandler = UtilityFactory::getInstance()->newMwHooksHandler(); $this->mwHooksHandler->deregisterListedHooks(); $this->applicationFactory = ApplicationFactory::getInstance(); }
public function categoryProvider() { $stringBuilder = UtilityFactory::getInstance()->newStringBuilder(); # 0 $conditionType = '\\SMW\\SPARQLStore\\QueryEngine\\Condition\\FalseCondition'; $description = new ClassDescription(array()); $orderByProperty = null; $expected = $stringBuilder->addString('<http://www.example.org> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#nothing> .')->addNewLine()->getString(); $provider[] = array($description, $orderByProperty, $conditionType, $expected); # 1 $conditionType = '\\SMW\\SPARQLStore\\QueryEngine\\Condition\\WhereCondition'; $category = new DIWikiPage('Foo', NS_CATEGORY); $categoryName = \SMWTurtleSerializer::getTurtleNameForExpElement(\SMWExporter::getInstance()->getResourceElementForWikiPage($category)); $description = new ClassDescription($category); $orderByProperty = null; $expected = $stringBuilder->addString("{ ?result rdf:type {$categoryName} . }")->addNewLine()->getString(); $provider[] = array($description, $orderByProperty, $conditionType, $expected); # 2 $conditionType = '\\SMW\\SPARQLStore\\QueryEngine\\Condition\\WhereCondition'; $categoryFoo = new DIWikiPage('Foo', NS_CATEGORY); $categoryFooName = \SMWTurtleSerializer::getTurtleNameForExpElement(\SMWExporter::getInstance()->getResourceElementForWikiPage($categoryFoo)); $categoryBar = new DIWikiPage('Bar', NS_CATEGORY); $categoryBarName = \SMWTurtleSerializer::getTurtleNameForExpElement(\SMWExporter::getInstance()->getResourceElementForWikiPage($categoryBar)); $description = new ClassDescription(array($categoryFoo, $categoryBar)); $orderByProperty = null; $expected = $stringBuilder->addString("{ ?result rdf:type {$categoryFooName} . }")->addNewLine()->addString('UNION')->addNewLine()->addString("{ ?result rdf:type {$categoryBarName} . }")->addNewLine()->getString(); $provider[] = array($description, $orderByProperty, $conditionType, $expected); # 3 $conditionType = '\\SMW\\SPARQLStore\\QueryEngine\\Condition\\WhereCondition'; $description = new ClassDescription(array($categoryFoo, $categoryBar)); $orderByProperty = new DIProperty('Foo'); $expected = $stringBuilder->addString('?result swivt:wikiPageSortKey ?resultsk .')->addNewLine()->addString("{ ?result rdf:type {$categoryFooName} . }")->addNewLine()->addString('UNION')->addNewLine()->addString("{ ?result rdf:type {$categoryBarName} . }")->addNewLine()->getString(); $provider[] = array($description, $orderByProperty, $conditionType, $expected); return $provider; }
public function semanticDataProvider() { // Is a dataprovider therefore can't use the setUp $this->semanticDataFactory = UtilityFactory::getInstance()->newSemanticDataFactory(); $this->dataValueFactory = DataValueFactory::getInstance(); $title = Title::newFromText('Foo'); #0 Empty container $foo = $this->semanticDataFactory->setSubject(DIWikiPage::newFromTitle($title))->newEmptySemanticData(); $provider[] = array($foo); #1 Single entry $foo = $this->semanticDataFactory->setSubject(DIWikiPage::newFromTitle($title))->newEmptySemanticData(); $foo->addDataValue($this->dataValueFactory->newPropertyValue('Has fooQuex', 'Bar')); $provider[] = array($foo); // #2 Single + single subobject entry $foo = $this->semanticDataFactory->setSubject(DIWikiPage::newFromTitle($title))->newEmptySemanticData(); $foo->addDataValue($this->dataValueFactory->newPropertyValue('Has fooQuex', 'Bar')); $subobject = new Subobject($title); $subobject->setSemanticData('Foo'); $subobject->addDataValue($this->dataValueFactory->newPropertyValue('Has subobjects', 'Bam')); $foo->addPropertyObjectValue($subobject->getProperty(), $subobject->getContainer()); $provider[] = array($foo); #3 Multiple entries $foo = $this->semanticDataFactory->setSubject(DIWikiPage::newFromTitle($title))->newEmptySemanticData(); $foo->addDataValue($this->dataValueFactory->newPropertyValue('Has fooQuex', 'Bar')); $foo->addDataValue($this->dataValueFactory->newPropertyValue('Has queez', 'Xeey')); $subobject = new Subobject($title); $subobject->setSemanticData('Foo'); $subobject->addDataValue($this->dataValueFactory->newPropertyValue('Has subobjects', 'Bam')); $subobject->addDataValue($this->dataValueFactory->newPropertyValue('Has fooQuex', 'Fuz')); $subobject->setSemanticData('Bar'); $subobject->addDataValue($this->dataValueFactory->newPropertyValue('Has fooQuex', 'Fuz')); $foo->addPropertyObjectValue($subobject->getProperty(), $subobject->getContainer()); $provider[] = array($foo); return $provider; }
protected function setUp() { parent::setUp(); $this->semanticDataFactory = UtilityFactory::getInstance()->newSemanticDataFactory(); $this->semanticDataValidator = UtilityFactory::getInstance()->newValidatorFactory()->newSemanticDataValidator(); $this->applicationFactory = ApplicationFactory::getInstance(); }
protected function setUp() { parent::setUp(); $this->semanticDataValidator = UtilityFactory::getInstance()->newValidatorFactory()->newSemanticDataValidator(); $this->applicationFactory = ApplicationFactory::getInstance(); $this->applicationFactory->getSettings()->set('smwgQueryDurationEnabled', false); }
protected function tearDown() { $pageDeleter = UtilityFactory::getInstance()->newPageDeleter(); $pageDeleter->doDeletePoolOfPages($this->subjects); $this->mwHooksHandler->restoreListedHooks(); parent::tearDown(); }
public function categoryProvider() { $stringBuilder = UtilityFactory::getInstance()->newStringBuilder(); # 0 $conditionType = '\\SMW\\SPARQLStore\\QueryEngine\\Condition\\FalseCondition'; $description = new ClassDescription(array()); $orderByProperty = null; $expected = $stringBuilder->addString('<http://www.example.org> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#nothing> .')->addNewLine()->getString(); $provider[] = array($description, $orderByProperty, $conditionType, $expected); # 1 $conditionType = '\\SMW\\SPARQLStore\\QueryEngine\\Condition\\WhereCondition'; $description = new ClassDescription(new DIWikiPage('Foo', NS_CATEGORY)); $orderByProperty = null; $expected = $stringBuilder->addString('{ ?result rdf:type wiki:Category-3AFoo . }')->addNewLine()->getString(); $provider[] = array($description, $orderByProperty, $conditionType, $expected); # 2 $conditionType = '\\SMW\\SPARQLStore\\QueryEngine\\Condition\\WhereCondition'; $description = new ClassDescription(array(new DIWikiPage('Foo', NS_CATEGORY), new DIWikiPage('Bar', NS_CATEGORY))); $orderByProperty = null; $expected = $stringBuilder->addString('{ ?result rdf:type wiki:Category-3AFoo . }')->addNewLine()->addString('UNION')->addNewLine()->addString('{ ?result rdf:type wiki:Category-3ABar . }')->addNewLine()->getString(); $provider[] = array($description, $orderByProperty, $conditionType, $expected); # 3 $conditionType = '\\SMW\\SPARQLStore\\QueryEngine\\Condition\\WhereCondition'; $description = new ClassDescription(array(new DIWikiPage('Foo', NS_CATEGORY), new DIWikiPage('Bar', NS_CATEGORY))); $orderByProperty = new DIProperty('Foo'); $expected = $stringBuilder->addString('?result swivt:wikiPageSortKey ?resultsk .')->addNewLine()->addString('{ ?result rdf:type wiki:Category-3AFoo . }')->addNewLine()->addString('UNION')->addNewLine()->addString('{ ?result rdf:type wiki:Category-3ABar . }')->addNewLine()->getString(); $provider[] = array($description, $orderByProperty, $conditionType, $expected); return $provider; }
protected function setUp() { parent::setUp(); $this->dataValueFactory = DataValueFactory::getInstance(); $this->queryResultValidator = UtilityFactory::getInstance()->newValidatorFactory()->newQueryResultValidator(); $this->semanticDataFactory = UtilityFactory::getInstance()->newSemanticDataFactory(); $this->testEnvironment->addConfiguration('smwgQueryResultCacheType', false); }
protected function setUp() { parent::setUp(); $this->applicationFactory = ApplicationFactory::getInstance(); $this->mwHooksHandler = UtilityFactory::getInstance()->newMwHooksHandler(); $this->mwHooksHandler->deregisterListedHooks(); $this->mwHooksHandler->register('ParserAfterTidy', $this->mwHooksHandler->getHookRegistry()->getDefinition('ParserAfterTidy')); }
protected function setUp() { parent::setUp(); $this->queryResultValidator = UtilityFactory::getInstance()->newValidatorFactory()->newQueryResultValidator(); $this->semanticDataFactory = UtilityFactory::getInstance()->newSemanticDataFactory(); $this->queryParser = new QueryParser(); // $this->getStore()->getSparqlDatabase()->deleteAll(); }
protected function setUp() { parent::setUp(); $this->stringValidator = UtilityFactory::getInstance()->newValidatorFactory()->newStringValidator(); $this->builder = new ParameterListDocBuilder(function ($key) { return $key; }); }
protected function setUp() { parent::setUp(); $this->applicationFactory = ApplicationFactory::getInstance(); $this->mwHooksHandler = UtilityFactory::getInstance()->newMwHooksHandler(); $this->mwHooksHandler->deregisterListedHooks(); $this->mwHooksHandler->register('InternalParseBeforeLinks', $this->mwHooksHandler->getHookRegistry()->getHandlerFor('InternalParseBeforeLinks')); }
protected function setUp() { parent::setUp(); $this->store = $this->getMockBuilder('\\SMW\\Store')->disableOriginalConstructor()->getMockForAbstractClass(); $this->applicationFactory = ApplicationFactory::getInstance(); $this->applicationFactory->registerObject('Store', $this->store); $this->apiFactory = UtilityFactory::getInstance()->newMwApiFactory(); }
protected function setUp() { parent::setUp(); $this->semanticDataValidator = UtilityFactory::getInstance()->newValidatorFactory()->newSemanticDataValidator(); $this->parserFactory = UtilityFactory::getInstance()->newParserFactory(); $this->applicationFactory = ApplicationFactory::getInstance(); $store = $this->getMockBuilder('\\SMW\\Store')->disableOriginalConstructor()->getMockForAbstractClass(); $this->applicationFactory->registerObject('Store', $store); }
protected function setUp() { parent::setUp(); $this->applicationFactory = ApplicationFactory::getInstance(); $store = $this->getMockBuilder('\\SMW\\Store')->disableOriginalConstructor()->getMockForAbstractClass(); $store->expects($this->any())->method('getPropertySubjects')->will($this->returnValue(array())); $this->applicationFactory->registerObject('Store', $store); $this->stringValidator = UtilityFactory::getInstance()->newValidatorFactory()->newStringValidator(); }
private function assertParserOutputForCase($case) { if (!isset($case['expected-output']) || !isset($case['expected-output']['to-contain'])) { return; } $subject = DIWikiPage::newFromText($case['subject'], isset($case['namespace']) ? constant($case['namespace']) : NS_MAIN); $parserOutput = UtilityFactory::getInstance()->newPageReader()->getEditInfo($subject->getTitle())->output; $this->stringValidator->assertThatStringContains($case['expected-output']['to-contain'], $parserOutput->getText(), $case['about']); }
protected function setUp() { parent::setUp(); $this->mwHooksHandler = UtilityFactory::getInstance()->newMwHooksHandler(); $this->mwHooksHandler->deregisterListedHooks()->invokeHooksFromRegistry(); $this->semanticDataValidator = UtilityFactory::getInstance()->newValidatorFactory()->newSemanticDataValidator(); $this->pageCreator = UtilityFactory::getInstance()->newPageCreator(); $this->applicationFactory = ApplicationFactory::getInstance(); $this->dataValueFactory = DataValueFactory::getInstance(); }
private function findFilesIn($location) { $provider = array(); $bulkFileProvider = UtilityFactory::getInstance()->newBulkFileProvider($location); $bulkFileProvider->searchByFileExtension('json'); foreach ($bulkFileProvider->getFiles() as $file) { $provider[] = array($file); } return $provider; }
protected function setUp() { parent::setUp(); $this->mwHooksHandler = UtilityFactory::getInstance()->newMwHooksHandler(); $this->mwHooksHandler->deregisterListedHooks()->invokeHooksFromRegistry(); $this->semanticDataValidator = UtilityFactory::getInstance()->newValidatorFactory()->newSemanticDataValidator(); $this->pageDeleter = new PageDeleter(); $this->applicationFactory = ApplicationFactory::getInstance(); $this->applicationFactory->getSettings()->set('smwgPageSpecialProperties', array('_MDAT')); }
protected function setUp() { parent::setUp(); // DIProperty::findPropertyTypeID is called during the test // which itself will access the store and to avoid unnecessary // DB reads inject a mock $store = $this->getMockBuilder('\\SMWSQLStore3')->disableOriginalConstructor()->getMock(); $this->semanticDataValidator = UtilityFactory::getInstance()->newValidatorFactory()->newSemanticDataValidator(); StoreFactory::setDefaultStoreForUnitTest($store); }
protected function setUp() { parent::setUp(); $this->semanticDataValidator = UtilityFactory::getInstance()->newValidatorFactory()->newSemanticDataValidator(); $this->applicationFactory = ApplicationFactory::getInstance(); $this->applicationFactory->getSettings()->set('smwgQueryDurationEnabled', false); // FIXME in the Query do not use global scope $this->smwgQMaxLimit = $GLOBALS['smwgQMaxLimit']; $GLOBALS['smwgQMaxLimit'] = 1000; }
public function i18nFileProvider() { $provider = array(); $bulkFileProvider = UtilityFactory::getInstance()->newBulkFileProvider($GLOBALS['wgMessagesDirs']['SemanticMediaWiki']); $bulkFileProvider->searchByFileExtension('json'); foreach ($bulkFileProvider->getFiles() as $file) { $provider[] = array($file); } return $provider; }
public function i18nFileProvider() { $provider = array(); $location = $GLOBALS['wgMessagesDirs']['semantic-breadcrumb-links']; $bulkFileProvider = UtilityFactory::getInstance()->newBulkFileProvider($location); $bulkFileProvider->searchByFileExtension('json'); foreach ($bulkFileProvider->getFiles() as $file) { $provider[] = array($file); } return $provider; }
public function namespaceProvider() { $stringBuilder = UtilityFactory::getInstance()->newStringBuilder(); # 0 $conditionType = '\\SMW\\SPARQLStore\\QueryEngine\\Condition\\WhereCondition'; $description = new NamespaceDescription(NS_MAIN); $orderByProperty = null; $expected = $stringBuilder->addString('{ ?result swivt:wikiNamespace "0"^^xsd:integer . }')->addNewLine()->getString(); $provider[] = array($description, $orderByProperty, $conditionType, $expected); return $provider; }
protected function setUp() { parent::setUp(); $this->applicationFactory = ApplicationFactory::getInstance(); $this->stringValidator = UtilityFactory::getInstance()->newValidatorFactory()->newStringValidator(); // This needs to be fixed but not now $this->mockbuilder = new MockObjectBuilder(); $this->mockbuilder->registerRepository(new CoreMockObjectRepository()); $this->mockbuilder->registerRepository(new MediaWikiMockObjectRepository()); $this->applicationFactory->getSettings()->set('smwgShowFactbox', SMW_FACTBOX_NONEMPTY); }
protected function setUp() { parent::setUp(); $this->applicationFactory = ApplicationFactory::getInstance(); $this->semanticDataFactory = UtilityFactory::getInstance()->newSemanticDataFactory(); $settings = array('smwgPageSpecialProperties' => array(), 'smwgEnableUpdateJobs' => false, 'smwgNamespacesWithSemanticLinks' => array(NS_MAIN => true)); foreach ($settings as $key => $value) { $this->applicationFactory->getSettings()->set($key, $value); } $store = $this->getMockBuilder('\\SMW\\Store')->disableOriginalConstructor()->getMockForAbstractClass(); $this->applicationFactory->registerObject('Store', $store); }
protected function setUp() { parent::setUp(); $validatorFactory = UtilityFactory::getInstance()->newValidatorFactory(); $stringValidator = $validatorFactory->newStringValidator(); $semanticDataValidator = $validatorFactory->newSemanticDataValidator(); $queryResultValidator = $validatorFactory->newQueryResultValidator(); $this->queryTestCaseProcessor = new QueryTestCaseProcessor($this->getStore(), $queryResultValidator, $stringValidator); $this->rdfTestCaseProcessor = new RdfTestCaseProcessor($this->getStore(), $stringValidator); $this->parserTestCaseProcessor = new ParserTestCaseProcessor($this->getStore(), $semanticDataValidator, $stringValidator); $this->eventDispatcher = EventHandler::getInstance()->getEventDispatcher(); }