本文整理汇总了PHP中SMW\DIWikiPage::getTitle方法的典型用法代码示例。如果您正苦于以下问题:PHP DIWikiPage::getTitle方法的具体用法?PHP DIWikiPage::getTitle怎么用?PHP DIWikiPage::getTitle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SMW\DIWikiPage
的用法示例。
在下文中一共展示了DIWikiPage::getTitle方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tryToFindLinksFor
/**
* @since 1.0
*
* @param DIWikiPage $subject
*/
public function tryToFindLinksFor(DIWikiPage $subject)
{
$prefixedText = $subject->getTitle()->getPrefixedText();
if (!$this->canBuildLinksFromText($prefixedText)) {
return;
}
$this->buildHierarchicalLinksFromText($prefixedText);
}
示例2: testReUploadDummyTextFileToEditFilePage
/**
* @depends testFileUploadForDummyTextFile
*/
public function testReUploadDummyTextFileToEditFilePage()
{
$subject = new DIWikiPage('Foo.txt', NS_FILE);
$dummyTextFile = $this->fixturesFileProvider->newUploadForDummyTextFile('Foo.txt');
$dummyTextFile->doUpload();
$this->pageEditor->editPage($subject->getTitle())->doEdit('[[Ichi::Maru|Kyū]]');
// File page content is kept from the initial upload
$expected = array('propertyCount' => 4, 'propertyKeys' => array('HasFile', '_MEDIA', '_MIME', '_SKEY', 'Ichi'), 'propertyValues' => array('File:Foo.txt', 'TEXT', 'text/plain', 'Foo.txt', 'Maru'));
$this->semanticDataValidator->assertThatPropertiesAreSet($expected, $this->getStore()->getSemanticData($subject));
}
示例3: testExportRedirect
public function testExportRedirect()
{
$semanticData = $this->semanticDataFactory->newEmptySemanticData(__METHOD__);
$redirectProperty = new DIProperty('_REDI');
$redirectTarget = new DIWikiPage('FooRedirectTarget', NS_MAIN, '');
$semanticData->addPropertyObjectValue($redirectProperty, DIWikiPage::newFromTitle($redirectTarget->getTitle(), '__red'));
$exportData = Exporter::getInstance()->makeExportData($semanticData);
$this->assertCount(1, $exportData->getValues(Exporter::getInstance()->getSpecialNsResource('swivt', 'redirectsTo')));
$this->assertCount(1, $exportData->getValues(Exporter::getInstance()->getSpecialNsResource('owl', 'sameAs')));
$expectedResourceElement = new ExpNsResource('FooRedirectTarget', Exporter::getInstance()->getNamespaceUri('wiki'), 'wiki', $redirectTarget);
$this->exportDataValidator->assertThatExportDataContainsResource($expectedResourceElement, Exporter::getInstance()->getSpecialNsResource('owl', 'sameAs'), $exportData);
}
示例4: testFileUploadForDummyTextFile
public function testFileUploadForDummyTextFile()
{
$subject = new DIWikiPage('RdfLinkedFile.txt', NS_FILE);
$fileNS = Localizer::getInstance()->getNamespaceTextById(NS_FILE);
$dummyTextFile = $this->fixturesFileProvider->newUploadForDummyTextFile('RdfLinkedFile.txt');
$dummyTextFile->doUpload('[[HasFile::File:RdfLinkedFile.txt]]');
$exportController = new ExportController(new RDFXMLSerializer());
$exportController->enableBacklinks(false);
ob_start();
$exportController->printPages(array($subject->getTitle()->getPrefixedDBKey()));
$output = ob_get_clean();
$expected = array("<rdfs:label>{$fileNS}:RdfLinkedFile.txt</rdfs:label>", '<swivt:file rdf:resource="' . $dummyTextFile->getLocalFile()->getFullURL() . '"/>', '<property:Media_type-23aux rdf:datatype="http://www.w3.org/2001/XMLSchema#string">TEXT</property:Media_type-23aux>', '<property:MIME_type-23aux rdf:datatype="http://www.w3.org/2001/XMLSchema#string">text/plain</property:MIME_type-23aux>');
$this->stringValidator->assertThatStringContains($expected, $output);
}
示例5: getDemographics
/**
* @since 2.1
*
* @see https://en.wikipedia.org/wiki/Demographics_of_Paris
*
* @return Subobject
*/
public function getDemographics()
{
if ($this->targetSubject === null) {
throw new RuntimeException('Expected a target subject');
}
$subobject = new Subobject($this->targetSubject->getTitle());
$subobject->setEmptyContainerForId('Paris#Demographics');
$yearProperty = new YearProperty();
$yearDataValue = $this->dataValueFactory->newPropertyObjectValue($yearProperty->getProperty(), '2009');
$subobject->addDataValue($yearDataValue);
$subobject->addDataValue($this->getAreaValue());
$subobject->addDataValue($this->getPopulationValue());
$subobject->addDataValue($this->getPopulationDensityValue());
return $subobject;
}
示例6: testForYetUnknownRedirectTarget
public function testForYetUnknownRedirectTarget()
{
$revision = $this->getMockBuilder('\\Revision')->disableOriginalConstructor()->getMock();
$wikiPage = $this->getMockBuilder('\\WikiPage')->disableOriginalConstructor()->getMock();
$wikiPage->expects($this->atLeastOnce())->method('getRevision')->will($this->returnValue($revision));
$pageCreator = $this->getMockBuilder('\\SMW\\MediaWiki\\PageCreator')->disableOriginalConstructor()->getMock();
$pageCreator->expects($this->atLeastOnce())->method('createPage')->will($this->returnValue($wikiPage));
$this->applicationFactory->registerObject('PageCreator', $pageCreator);
$subject = new DIWikiPage('Foo', NS_MAIN);
$target = new DIWikiPage('Bar', NS_MAIN);
$store = $this->getMockBuilder('\\SMW\\Store')->disableOriginalConstructor()->getMockForAbstractClass();
$store->expects($this->once())->method('changeTitle')->with($this->equalTo($subject->getTitle()), $this->equalTo($target->getTitle()), $this->anything(), $this->anything());
$semanticData = new SemanticData($subject);
$semanticData->addPropertyObjectValue(new DIProperty('_REDI'), $target);
$instance = new StoreUpdater($store, $semanticData);
$instance->setUpdateJobsEnabledState(true);
$instance->doUpdate();
}
示例7: testGetTitleAndNewFromTitleRoundrtip
/**
* @dataProvider instanceProvider
*/
public function testGetTitleAndNewFromTitleRoundrtip(DIWikiPage $di)
{
$newDi = DIWikiPage::newFromTitle($di->getTitle());
$this->assertTrue($newDi->equals($di));
}