当前位置: 首页>>代码示例>>PHP>>正文


PHP DIWikiPage::newFromTitle方法代码示例

本文整理汇总了PHP中SMW\DIWikiPage::newFromTitle方法的典型用法代码示例。如果您正苦于以下问题:PHP DIWikiPage::newFromTitle方法的具体用法?PHP DIWikiPage::newFromTitle怎么用?PHP DIWikiPage::newFromTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SMW\DIWikiPage的用法示例。


在下文中一共展示了DIWikiPage::newFromTitle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testImportOfRecordValues

 public function testImportOfRecordValues()
 {
     $this->importedTitles = array('Property:Has record number field', 'Property:Has record page field', 'Property:Has record text field', 'Property:Has record type', 'Property:Has record type for single test', 'RecordDataTypePage', 'RecordDataTypeRegressionTest/WithSubpage', 'RecordDataTypeRegressionTest');
     $this->titleValidator->assertThatTitleIsKnown($this->importedTitles);
     $title = Title::newFromText('RecordDataTypeRegressionTest');
     $expectedCategoryAsWikiValue = array('property' => new DIProperty('_INST'), 'propertyValues' => array('Regression test', 'Data type regression test', 'Record type regression test'));
     $expectedSomeProperties = array('properties' => array(DIProperty::newFromUserLabel('RecordDataTypePage'), DIProperty::newFromUserLabel('BarText'), DIProperty::newFromUserLabel('BooPage'), DIProperty::newFromUserLabel('FooPage'), DIProperty::newFromUserLabel('QyuPage'), new DIProperty('_ASK'), new DIProperty('_MDAT'), new DIProperty('_SKEY'), new DIProperty('_SOBJ'), new DIProperty('_INST')));
     $property = DIProperty::newFromUserLabel('Has record type for single test');
     $valueString = 'ForSingleTestAsPage;ForSingleTestAsText;3333';
     if ($property->findPropertyTypeID() === '_rec') {
         $valueString = 'ForSingleTestAsPage; ForSingleTestAsText; 3333';
     }
     $expectedRecordTypeValuesAsWikiValue = array('subject' => DIWikiPage::newFromTitle($title), 'record' => $property, 'property' => $property, 'propertyValues' => array($valueString, '?; ?; ?'));
     $expectedRecordPageFieldValuesAsWikiValue = array('subject' => DIWikiPage::newFromTitle($title), 'record' => DIProperty::newFromUserLabel('Has record type'), 'property' => DIProperty::newFromUserLabel('Has record page field'), 'propertyValues' => array('FooPage', 'QyuPageOnSubobject', 'QyuPage', 'XeuiPageOnSubobject', 'RecordDataTypePage', 'BooPage'));
     $expectedRecordTextFieldValuesAsWikiValue = array('subject' => DIWikiPage::newFromTitle($title), 'record' => DIProperty::newFromUserLabel('Has record type'), 'property' => DIProperty::newFromUserLabel('Has record text field'), 'propertyValues' => array('BarText', 'ForSingleTestAsText', 'FooText', 'XeuiTextOnSubobject'));
     $expectedRecordNumberFieldValuesAsNumber = array('subject' => DIWikiPage::newFromTitle(Title::newFromText('RecordDataTypeRegressionTest/WithSubpage')), 'record' => DIProperty::newFromUserLabel('Has record type'), 'property' => DIProperty::newFromUserLabel('Has record number field'), 'propertyValues' => array(1111, 9001, 9999, 1009));
     $semanticDataFinder = new ByPageSemanticDataFinder();
     $semanticDataFinder->setTitle($title)->setStore($this->getStore());
     $semanticDataBatches = array($this->getStore()->getSemanticData(DIWikiPage::newFromTitle($title)));
     foreach ($semanticDataBatches as $semanticData) {
         $this->semanticDataValidator->assertThatCategoriesAreSet($expectedCategoryAsWikiValue, $semanticData);
         $this->semanticDataValidator->assertThatPropertiesAreSet($expectedSomeProperties, $semanticData);
         $this->assertThatSemanticDataValuesAreSet($expectedRecordTypeValuesAsWikiValue, $semanticData);
     }
     $this->assertThatRecordValuesAreSet($expectedRecordTypeValuesAsWikiValue);
     $this->assertThatRecordValuesAreSet($expectedRecordPageFieldValuesAsWikiValue);
     $this->assertThatRecordValuesAreSet($expectedRecordTextFieldValuesAsWikiValue);
     $this->assertThatRecordValuesAreSet($expectedRecordNumberFieldValuesAsNumber);
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:29,代码来源:RecordDataTypeTest.php

示例2: deleteSubject

 /**
  * @see SMWStore::deleteSubject
  *
  * @since 1.8
  * @param Title $title
  */
 public function deleteSubject(Title $title)
 {
     // @deprecated since 2.1, use 'SMW::SQLStore::BeforeDeleteSubjectComplete'
     wfRunHooks('SMWSQLStore3::deleteSubjectBefore', array($this->store, $title));
     wfRunHooks('SMW::SQLStore::BeforeDeleteSubjectComplete', array($this->store, $title));
     $id = $this->store->getObjectIds()->getSMWPageID($title->getDBkey(), $title->getNamespace(), $title->getInterwiki(), '', false);
     $emptySemanticData = new SemanticData(DIWikiPage::newFromTitle($title));
     $subobjects = $this->getSubobjects($emptySemanticData->getSubject());
     $this->doDataUpdate($emptySemanticData);
     if ($title->getNamespace() === SMW_NS_CONCEPT) {
         // make sure to clear caches
         $db = $this->store->getConnection();
         $db->delete('smw_fpt_conc', array('s_id' => $id), 'SMW::deleteSubject::Conc');
         $db->delete(SMWSQLStore3::CONCEPT_CACHE_TABLE, array('o_id' => $id), 'SMW::deleteSubject::Conccache');
     }
     // Mark subject/subobjects with a special IW, the final removal is being
     // triggered by the `ByIdDataRebuildDispatcher`
     $this->store->getObjectIds()->updateInterwikiField($id, $emptySemanticData->getSubject(), SMW_SQL3_SMWDELETEIW);
     foreach ($subobjects as $smw_id => $subobject) {
         $this->store->getObjectIds()->updateInterwikiField($smw_id, $subobject, SMW_SQL3_SMWDELETEIW);
     }
     // 1.9.0.1
     // The update of possible associative entities is handled by DeleteSubjectJob which is invoked during
     // the ArticleDelete hook
     // @deprecated since 2.1, use 'SMW::SQLStore::AfterDeleteSubjectComplete'
     wfRunHooks('SMWSQLStore3::deleteSubjectAfter', array($this->store, $title));
     wfRunHooks('SMW::SQLStore::AfterDeleteSubjectComplete', array($this->store, $title));
 }
开发者ID:ReachingOut,项目名称:SemanticMediaWiki,代码行数:34,代码来源:SMW_SQLStore3_Writers.php

示例3: createDataItemByPropertyId

 protected function createDataItemByPropertyId($propertyId)
 {
     $dataItem = null;
     switch ($propertyId) {
         case DIProperty::TYPE_MODIFICATION_DATE:
             $dataItem = DITime::newFromTimestamp($this->pageInfo->getModificationDate());
             break;
         case DIProperty::TYPE_CREATION_DATE:
             $dataItem = DITime::newFromTimestamp($this->pageInfo->getCreationDate());
             break;
         case DIProperty::TYPE_NEW_PAGE:
             $dataItem = new DIBoolean($this->pageInfo->isNewPage());
             break;
         case DIProperty::TYPE_LAST_EDITOR:
             $dataItem = $this->pageInfo->getLastEditor() ? DIWikiPage::newFromTitle($this->pageInfo->getLastEditor()) : null;
             break;
         case DIProperty::TYPE_MEDIA:
             $dataItem = $this->pageInfo->isFilePage() && $this->pageInfo->getMediaType() !== '' && $this->pageInfo->getMediaType() !== null ? new DIBlob($this->pageInfo->getMediaType()) : null;
             break;
         case DIProperty::TYPE_MIME:
             $dataItem = $this->pageInfo->isFilePage() && $this->pageInfo->getMimeType() !== '' && $this->pageInfo->getMimeType() !== null ? new DIBlob($this->pageInfo->getMimeType()) : null;
             break;
     }
     return $dataItem;
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:25,代码来源:PredefinedPropertyAnnotator.php

示例4: addPropertyValues

 /**
  * @see PropertyAnnotatorDecorator::addPropertyValues
  */
 protected function addPropertyValues()
 {
     if (!$this->redirectTargetFinder->hasRedirectTarget()) {
         return;
     }
     $this->getSemanticData()->addPropertyObjectValue(new DIProperty('_REDI'), DIWikiPage::newFromTitle($this->redirectTargetFinder->getRedirectTarget()));
 }
开发者ID:ReachingOut,项目名称:SemanticMediaWiki,代码行数:10,代码来源:RedirectPropertyAnnotator.php

示例5: 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;
 }
开发者ID:ReachingOut,项目名称:SemanticMediaWiki,代码行数:35,代码来源:SemanticDataSerializerTest.php

示例6: addListenersToCollection

 private function addListenersToCollection()
 {
     $this->eventListenerCollection->registerCallback('factbox.cache.delete', function ($dispatchContext) {
         if ($dispatchContext->has('subject')) {
             $title = $dispatchContext->get('subject')->getTitle();
         } else {
             $title = $dispatchContext->get('title');
         }
         $applicationFactory = ApplicationFactory::getInstance();
         $applicationFactory->getCache()->delete($applicationFactory->newCacheFactory()->getFactboxCacheKey($title->getArticleID()));
     });
     $this->eventListenerCollection->registerCallback('exporter.reset', function () {
         Exporter::getInstance()->clear();
     });
     $this->eventListenerCollection->registerCallback('query.comparator.reset', function () {
         QueryComparator::getInstance()->clear();
     });
     /**
      * Emitted during NewRevisionFromEditComplete, UpdateJob, ArticleDelete
      */
     $this->eventListenerCollection->registerCallback('cached.propertyvalues.prefetcher.reset', function ($dispatchContext) {
         if ($dispatchContext->has('title')) {
             $subject = DIWikiPage::newFromTitle($dispatchContext->get('title'));
         } else {
             $subject = $dispatchContext->get('subject');
         }
         wfDebugLog('smw', 'Clear CachedPropertyValuesPrefetcher for ' . $subject->getHash());
         $applicationFactory = ApplicationFactory::getInstance();
         $applicationFactory->getCachedPropertyValuesPrefetcher()->resetCacheBy($subject);
         $dispatchContext->set('propagationstop', true);
     });
     $this->registerStateChangeEvents();
     return $this->eventListenerCollection;
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:34,代码来源:EventListenerRegistry.php

示例7: testGetPropertyValues

 public function testGetPropertyValues()
 {
     $instance = StubSemanticData::newFromSemanticData(new SemanticData(DIWikiPage::newFromTitle(Title::newFromText(__METHOD__))), $this->store);
     $this->assertInstanceOf('SMW\\DIWikiPage', $instance->getSubject());
     $this->assertEmpty($instance->getPropertyValues(new DIProperty('unknownInverseProperty', true)));
     $this->assertEmpty($instance->getPropertyValues(new DIProperty('unknownProperty')));
 }
开发者ID:WolfgangFahl,项目名称:SemanticMediaWiki,代码行数:7,代码来源:Sql3StubSemanticDataTest.php

示例8: testPageImportToCreateRedirect

 public function testPageImportToCreateRedirect()
 {
     $this->importedTitles = array('SimplePageRedirectRegressionTest', 'ToBeSimplePageRedirect');
     $this->titleValidator->assertThatTitleIsKnown($this->importedTitles);
     $main = Title::newFromText('SimplePageRedirectRegressionTest');
     $expectedCategoryAsWikiValue = array('property' => new DIProperty(DIProperty::TYPE_CATEGORY), 'propertyValues' => array('Regression test', 'Redirect test', 'Simple redirect test'));
     $expectedSomeProperties = array('properties' => array(new DIProperty('Has regression test')));
     $expectedRedirectAsWikiValue = array('property' => new DIProperty('_REDI'), 'propertyValues' => array('ToBeSimplePageRedirect', 'NewPageRedirectRegressionTest', 'NewTargetPageRedirectRegressionTest'));
     $newRedirectPage = $this->createPageWithRedirectFor('NewPageRedirectRegressionTest', 'SimplePageRedirectRegressionTest');
     $this->testEnvironment->executePendingDeferredUpdates();
     $this->movePageToTargetRedirect($newRedirectPage, 'NewTargetPageRedirectRegressionTest');
     $this->testEnvironment->executePendingDeferredUpdates();
     $this->pageRefresher->doRefreshPoolOfPages(array($main, $newRedirectPage, 'NewTargetPageRedirectRegressionTest'));
     $this->testEnvironment->executePendingDeferredUpdates();
     $semanticDataBatches = array($this->getStore()->getSemanticData(DIWikiPage::newFromTitle($main)));
     $this->assertThatCategoriesAreSet($expectedCategoryAsWikiValue, $semanticDataBatches);
     $this->assertThatPropertiesAreSet($expectedSomeProperties, $semanticDataBatches);
     $inSemanticDataFetcher = new InSemanticDataFetcher($this->getStore());
     $inSemanticData = $inSemanticDataFetcher->getSemanticData(DIWikiPage::newFromTitle($main));
     // When running sqlite, the database select returns an empty result which
     // is probably due to some DB-prefix issues in MW's DatabaseBaseSqlite
     // implementation and for non-sqlite see #212 / bug 62856
     if ($inSemanticData->getProperties() === array()) {
         $this->markTestSkipped("Skipping test either because of sqlite or MW-{$GLOBALS['wgVersion']} / bug 62856");
     }
     $this->assertThatSemanticDataValuesForPropertyAreSet($expectedRedirectAsWikiValue, $inSemanticData);
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:27,代码来源:RedirectPageTest.php

示例9: testRemovePropertyObjectValue

 /**
  * @dataProvider removePropertyObjectProvider
  */
 public function testRemovePropertyObjectValue($title, $property, $dataItem)
 {
     $instance = StubSemanticData::newFromSemanticData(new SemanticData(DIWikiPage::newFromTitle($title)), $this->store);
     $instance->addPropertyObjectValue($property, $dataItem);
     $this->assertFalse($instance->isEmpty());
     $instance->removePropertyObjectValue($property, $dataItem);
     $this->assertTrue($instance->isEmpty());
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:11,代码来源:Sql3StubSemanticDataTest.php

示例10: dataItemDataProvider

 public function dataItemDataProvider()
 {
     // Single
     $subject = array(DIWikiPage::newFromTitle(Title::newFromText(__METHOD__)));
     // Multiple
     $subjects = array(DIWikiPage::newFromTitle(Title::newFromText(__METHOD__ . 'm-0')), DIWikiPage::newFromTitle(Title::newFromText(__METHOD__ . 'm-1')), DIWikiPage::newFromTitle(Title::newFromText(__METHOD__ . 'm-2')));
     return array(array($subjects, array(), array('_PVAL', '_LIST'), array('diff' => true, 'job' => true)), array(array(), $subjects, array('_PVAL', '_LIST'), array('diff' => true, 'job' => true)), array($subject, $subjects, array('_PVAL', '_LIST'), array('diff' => true, 'job' => true)), array($subject, array(), array('_PVAL', '_LIST'), array('diff' => true, 'job' => true)), array($subject, array(), array('_PVAL'), array('diff' => true, 'job' => true)), array($subjects, $subjects, array('_PVAL'), array('diff' => false, 'job' => false)), array($subject, $subject, array('_PVAL'), array('diff' => false, 'job' => false)), array($subjects, $subjects, array('_PVAL', '_LIST'), array('diff' => true, 'job' => true)), array($subject, $subject, array('_PVAL', '_LIST'), array('diff' => true, 'job' => true)));
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:8,代码来源:PropertyTypeDiffFinderTest.php

示例11: outputDataProvider

 public function outputDataProvider()
 {
     $language = Language::factory('en');
     $title = MockTitle::buildMockForMainNamespace(__METHOD__ . 'mock-subject');
     $title->expects($this->atLeastOnce())->method('exists')->will($this->returnValue(true));
     $subject = DIWikiPage::newFromTitle($title);
     $semanticData = $this->getMockBuilder('\\SMW\\SemanticData')->disableOriginalConstructor()->getMock();
     $semanticData->expects($this->atLeastOnce())->method('getSubject')->will($this->returnValue($subject));
     $semanticData->expects($this->atLeastOnce())->method('hasVisibleProperties')->will($this->returnValue(true));
     $semanticData->expects($this->atLeastOnce())->method('getPropertyValues')->will($this->returnValue(array(DIWikiPage::newFromTitle($title))));
     $semanticData->expects($this->atLeastOnce())->method('getProperties')->will($this->returnValue(array(new DIProperty(__METHOD__ . 'property'))));
     #0 Simple factbox build, returning content
     $title = MockTitle::buildMock(__METHOD__ . 'title-with-content');
     $title->expects($this->atLeastOnce())->method('exists')->will($this->returnValue(true));
     $title->expects($this->atLeastOnce())->method('getNamespace')->will($this->returnValue(NS_MAIN));
     $title->expects($this->atLeastOnce())->method('getPageLanguage')->will($this->returnValue($language));
     $title->expects($this->atLeastOnce())->method('getArticleID')->will($this->returnValue(9098));
     $outputPage = $this->getMockBuilder('\\OutputPage')->disableOriginalConstructor()->getMock();
     $outputPage->expects($this->atLeastOnce())->method('getTitle')->will($this->returnValue($title));
     $outputPage->expects($this->atLeastOnce())->method('getContext')->will($this->returnValue(new \RequestContext()));
     $provider[] = array(array('smwgNamespacesWithSemanticLinks' => array(NS_MAIN => true), 'outputPage' => $outputPage, 'parserOutput' => $this->makeParserOutput($semanticData)), array('text' => $subject->getDBKey()));
     #1 Disabled namespace, no return value expected
     $title = MockTitle::buildMock(__METHOD__ . 'title-ns-disabled');
     $title->expects($this->atLeastOnce())->method('getNamespace')->will($this->returnValue(NS_MAIN));
     $title->expects($this->atLeastOnce())->method('getPageLanguage')->will($this->returnValue($language));
     $title->expects($this->atLeastOnce())->method('getArticleID')->will($this->returnValue(90000));
     $outputPage = $this->getMockBuilder('\\OutputPage')->disableOriginalConstructor()->getMock();
     $outputPage->expects($this->atLeastOnce())->method('getTitle')->will($this->returnValue($title));
     $outputPage->expects($this->atLeastOnce())->method('getContext')->will($this->returnValue(new \RequestContext()));
     $provider[] = array(array('smwgNamespacesWithSemanticLinks' => array(NS_MAIN => false), 'outputPage' => $outputPage, 'parserOutput' => $this->makeParserOutput($semanticData)), array('text' => ''));
     // #2 Specialpage, no return value expected
     $title = MockTitle::buildMock(__METHOD__ . 'mock-specialpage');
     $title->expects($this->atLeastOnce())->method('getPageLanguage')->will($this->returnValue($language));
     $title->expects($this->atLeastOnce())->method('isSpecialPage')->will($this->returnValue(true));
     $outputPage = $this->getMockBuilder('\\OutputPage')->disableOriginalConstructor()->getMock();
     $outputPage->expects($this->atLeastOnce())->method('getTitle')->will($this->returnValue($title));
     $outputPage->expects($this->atLeastOnce())->method('getContext')->will($this->returnValue(new \RequestContext()));
     $provider[] = array(array('smwgNamespacesWithSemanticLinks' => array(NS_MAIN => true), 'outputPage' => $outputPage, 'parserOutput' => $this->makeParserOutput($semanticData)), array('text' => ''));
     // #3 Redirect, no return value expected
     $title = MockTitle::buildMock(__METHOD__ . 'mock-redirect');
     $title->expects($this->atLeastOnce())->method('getPageLanguage')->will($this->returnValue($language));
     $title->expects($this->atLeastOnce())->method('isRedirect')->will($this->returnValue(true));
     $outputPage = $this->getMockBuilder('\\OutputPage')->disableOriginalConstructor()->getMock();
     $outputPage->expects($this->atLeastOnce())->method('getTitle')->will($this->returnValue($title));
     $outputPage->expects($this->atLeastOnce())->method('getContext')->will($this->returnValue(new \RequestContext()));
     $provider[] = array(array('smwgNamespacesWithSemanticLinks' => array(NS_MAIN => true), 'outputPage' => $outputPage, 'parserOutput' => $this->makeParserOutput($semanticData)), array('text' => ''));
     // #4 Oldid
     $title = MockTitle::buildMockForMainNamespace(__METHOD__ . 'mock-oldid');
     $title->expects($this->atLeastOnce())->method('exists')->will($this->returnValue(true));
     $title->expects($this->atLeastOnce())->method('getPageLanguage')->will($this->returnValue($language));
     $outputPage = $this->getMockBuilder('\\OutputPage')->disableOriginalConstructor()->getMock();
     $outputPage->expects($this->atLeastOnce())->method('getTitle')->will($this->returnValue($title));
     $context = new \RequestContext();
     $context->setRequest(new \FauxRequest(array('oldid' => 9001), true));
     $outputPage->expects($this->atLeastOnce())->method('getContext')->will($this->returnValue($context));
     $provider[] = array(array('smwgNamespacesWithSemanticLinks' => array(NS_MAIN => true), 'outputPage' => $outputPage, 'parserOutput' => $this->makeParserOutput($semanticData)), array('text' => $subject->getDBKey()));
     return $provider;
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:58,代码来源:OutputPageParserOutputTest.php

示例12: testPageDelete

 public function testPageDelete()
 {
     $this->title = Title::newFromText(__METHOD__);
     $pageCreator = new PageCreator();
     $pageCreator->createPage($this->title)->doEdit('[[Has function hook test::page delete]]');
     $this->semanticDataValidator->assertThatSemanticDataIsNotEmpty($this->getStore()->getSemanticData(DIWikiPage::newFromTitle($this->title)));
     $this->pageDeleter->deletePage($this->title);
     $this->semanticDataValidator->assertThatSemanticDataIsEmpty($this->getStore()->getSemanticData(DIWikiPage::newFromTitle($this->title)));
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:9,代码来源:MediaWikiIntegrationForRegisteredHookTest.php

示例13: testAskToCreatePropertyAnnotationFromTranscludedTemplate

 public function testAskToCreatePropertyAnnotationFromTranscludedTemplate()
 {
     $subject = DIWikiPage::newFromTitle(Title::newFromText(__METHOD__));
     $this->pageCreator->createPage(Title::newFromText('AskTemplateToAddPropertyAnnotation', NS_TEMPLATE))->doEdit('<includeonly>{{#set:|SetPropertyByAskTemplate=1234}}</includeonly>');
     $this->pageCreator->createPage(Title::newFromText(__METHOD__ . '00'))->doEdit('{{#set:|TestPropertyByAskTemplate=TestValueByAskTemplate}}');
     $this->pageCreator->createPage($subject->getTitle())->doEdit('{{#ask:[[TestPropertyByAskTemplate::TestValueByAskTemplate]]|link=none|sep=|template=AskTemplateToAddPropertyAnnotation}}');
     $expected = array('propertyCount' => 4, 'propertyKeys' => array('_ASK', '_MDAT', '_SKEY', 'SetPropertyByAskTemplate'));
     $this->semanticDataValidator->assertThatPropertiesAreSet($expected, $this->getStore()->getSemanticData($subject));
 }
开发者ID:brandonphuong,项目名称:mediawiki,代码行数:9,代码来源:AskParserFunctionDBIntegrationTest.php

示例14: testAddedCategoryAndChangedDefaultsortWithoutPredefinedPropertiesForNewPage

 public function testAddedCategoryAndChangedDefaultsortWithoutPredefinedPropertiesForNewPage()
 {
     $this->applicationFactory->getSettings()->set('smwgPageSpecialProperties', array());
     $title = Title::newFromText(__METHOD__);
     $subject = DIWikiPage::newFromTitle($title);
     $this->pageCreator->createPage($title)->doEdit('{{DEFAULTSORT:SortForFoo}} [[Category:SingleCategory]]');
     $expected = array('propertyCount' => 2, 'propertyKeys' => array('_SKEY', '_INST'), 'propertyValues' => array('SortForFoo', 'SingleCategory'));
     $this->semanticDataValidator->assertThatPropertiesAreSet($expected, $this->getStore()->getSemanticData($subject));
 }
开发者ID:WolfgangFahl,项目名称:SemanticMediaWiki,代码行数:9,代码来源:PredefinedPropertyAnnotationDBIntegrationTest.php

示例15: doUpdate

 private function doUpdate()
 {
     LinkCache::singleton()->clear();
     $this->applicationFactory = ApplicationFactory::getInstance();
     if ($this->getTitle()->exists()) {
         return $this->doPrepareForUpdate();
     }
     $this->applicationFactory->getStore()->clearData(DIWikiPage::newFromTitle($this->getTitle()));
     return true;
 }
开发者ID:ReachingOut,项目名称:SemanticMediaWiki,代码行数:10,代码来源:UpdateJob.php


注:本文中的SMW\DIWikiPage::newFromTitle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。