php SMW-Tests-Utils-UtilityFactory类(方法)实例源码

下面列出了php SMW-Tests-Utils-UtilityFactory 类(方法)源码代码实例,从而了解它的用法。

作者:WolfgangFah    项目:SemanticMediaWik   
protected function setUp()
 {
     parent::setUp();
     $this->dataValueFactory = DataValueFactory::getInstance();
     $this->queryResultValidator = UtilityFactory::getInstance()->newValidatorFactory()->newQueryResultValidator();
     $this->semanticDataFactory = UtilityFactory::getInstance()->newSemanticDataFactory();
 }

作者:WolfgangFah    项目:SemanticMediaWik   
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;
 }

作者:WolfgangFah    项目:SemanticMediaWik   
protected function tearDown()
 {
     ApplicationFactory::getInstance()->clear();
     $pageDeleter = UtilityFactory::getInstance()->newPageDeleter();
     $pageDeleter->doDeletePoolOfPages($this->importedTitles);
     parent::tearDown();
 }

作者:brandonphuon    项目:mediawik   
protected function setUp()
 {
     parent::setUp();
     $this->mwHooksHandler = UtilityFactory::getInstance()->newMwHooksHandler();
     $this->mwHooksHandler->deregisterListedHooks();
     $this->applicationFactory = ApplicationFactory::getInstance();
 }

作者:jongfel    项目:SemanticMediaWik   
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;
 }

作者:ReachingOu    项目:SemanticMediaWik   
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;
 }

作者:WolfgangFah    项目:SemanticMediaWik   
protected function setUp()
 {
     parent::setUp();
     $this->semanticDataFactory = UtilityFactory::getInstance()->newSemanticDataFactory();
     $this->semanticDataValidator = UtilityFactory::getInstance()->newValidatorFactory()->newSemanticDataValidator();
     $this->applicationFactory = ApplicationFactory::getInstance();
 }

作者:whysass    项目:kmwik   
protected function setUp()
 {
     parent::setUp();
     $this->semanticDataValidator = UtilityFactory::getInstance()->newValidatorFactory()->newSemanticDataValidator();
     $this->applicationFactory = ApplicationFactory::getInstance();
     $this->applicationFactory->getSettings()->set('smwgQueryDurationEnabled', false);
 }

作者:WolfgangFah    项目:SemanticMediaWik   
protected function tearDown()
 {
     $pageDeleter = UtilityFactory::getInstance()->newPageDeleter();
     $pageDeleter->doDeletePoolOfPages($this->subjects);
     $this->mwHooksHandler->restoreListedHooks();
     parent::tearDown();
 }

作者:whysass    项目:kmwik   
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;
 }

作者:jongfel    项目:SemanticMediaWik   
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);
 }

作者:whysass    项目:kmwik   
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'));
 }

作者:WolfgangFah    项目:SemanticMediaWik   
protected function setUp()
 {
     parent::setUp();
     $this->queryResultValidator = UtilityFactory::getInstance()->newValidatorFactory()->newQueryResultValidator();
     $this->semanticDataFactory = UtilityFactory::getInstance()->newSemanticDataFactory();
     $this->queryParser = new QueryParser();
     //	$this->getStore()->getSparqlDatabase()->deleteAll();
 }

作者:jongfel    项目:SemanticMediaWik   
protected function setUp()
 {
     parent::setUp();
     $this->stringValidator = UtilityFactory::getInstance()->newValidatorFactory()->newStringValidator();
     $this->builder = new ParameterListDocBuilder(function ($key) {
         return $key;
     });
 }

作者:jongfel    项目:SemanticMediaWik   
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'));
 }

作者:jongfel    项目:SemanticMediaWik   
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();
 }

作者:brandonphuon    项目:mediawik   
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);
 }

作者:whysass    项目:kmwik   
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();
 }

作者:brandonphuon    项目:mediawik   
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']);
 }

作者:WolfgangFah    项目:SemanticMediaWik   
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();
 }


问题


面经


文章

微信
公众号

扫码关注公众号