本文整理汇总了PHP中SMW\Tests\Utils\UtilityFactory类的典型用法代码示例。如果您正苦于以下问题:PHP UtilityFactory类的具体用法?PHP UtilityFactory怎么用?PHP UtilityFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UtilityFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
protected function setUp()
{
parent::setUp();
$this->dataValueFactory = DataValueFactory::getInstance();
$this->queryResultValidator = UtilityFactory::getInstance()->newValidatorFactory()->newQueryResultValidator();
$this->semanticDataFactory = UtilityFactory::getInstance()->newSemanticDataFactory();
}
示例2: setUp
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;
}
示例3: tearDown
protected function tearDown()
{
ApplicationFactory::getInstance()->clear();
$pageDeleter = UtilityFactory::getInstance()->newPageDeleter();
$pageDeleter->doDeletePoolOfPages($this->importedTitles);
parent::tearDown();
}
示例4: setUp
protected function setUp()
{
parent::setUp();
$this->mwHooksHandler = UtilityFactory::getInstance()->newMwHooksHandler();
$this->mwHooksHandler->deregisterListedHooks();
$this->applicationFactory = ApplicationFactory::getInstance();
}
开发者ID:brandonphuong,项目名称:mediawiki,代码行数:7,代码来源:SemanticMediaWikiProvidedHookInterfaceIntegrationTest.php
示例5: categoryProvider
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;
}
示例6: semanticDataProvider
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;
}
示例7: setUp
protected function setUp()
{
parent::setUp();
$this->semanticDataFactory = UtilityFactory::getInstance()->newSemanticDataFactory();
$this->semanticDataValidator = UtilityFactory::getInstance()->newValidatorFactory()->newSemanticDataValidator();
$this->applicationFactory = ApplicationFactory::getInstance();
}
示例8: setUp
protected function setUp()
{
parent::setUp();
$this->semanticDataValidator = UtilityFactory::getInstance()->newValidatorFactory()->newSemanticDataValidator();
$this->applicationFactory = ApplicationFactory::getInstance();
$this->applicationFactory->getSettings()->set('smwgQueryDurationEnabled', false);
}
示例9: tearDown
protected function tearDown()
{
$pageDeleter = UtilityFactory::getInstance()->newPageDeleter();
$pageDeleter->doDeletePoolOfPages($this->subjects);
$this->mwHooksHandler->restoreListedHooks();
parent::tearDown();
}
开发者ID:WolfgangFahl,项目名称:SemanticMediaWiki,代码行数:7,代码来源:SemanticDataSortKeyUpdateDBIntegrationTest.php
示例10: categoryProvider
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;
}
示例11: setUp
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);
}
示例12: setUp
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'));
}
示例13: setUp
protected function setUp()
{
parent::setUp();
$this->queryResultValidator = UtilityFactory::getInstance()->newValidatorFactory()->newQueryResultValidator();
$this->semanticDataFactory = UtilityFactory::getInstance()->newSemanticDataFactory();
$this->queryParser = new QueryParser();
// $this->getStore()->getSparqlDatabase()->deleteAll();
}
示例14: setUp
protected function setUp()
{
parent::setUp();
$this->stringValidator = UtilityFactory::getInstance()->newValidatorFactory()->newStringValidator();
$this->builder = new ParameterListDocBuilder(function ($key) {
return $key;
});
}
示例15: setUp
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'));
}