本文整理汇总了PHP中SMW\DIWikiPage::newFromText方法的典型用法代码示例。如果您正苦于以下问题:PHP DIWikiPage::newFromText方法的具体用法?PHP DIWikiPage::newFromText怎么用?PHP DIWikiPage::newFromText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SMW\DIWikiPage
的用法示例。
在下文中一共展示了DIWikiPage::newFromText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: subjectProvider
public function subjectProvider()
{
$provider[] = array(DIWikiPage::newFromText('Foo'));
$provider[] = array(DIWikiPage::newFromText('Bar', SMW_NS_PROPERTY));
$provider[] = array(DIWikiPage::newFromText('Modification date', SMW_NS_PROPERTY));
return $provider;
}
示例2: testErrorContainerForSamePropertyButDifferentMsg
public function testErrorContainerForSamePropertyButDifferentMsg()
{
$instance = new Error(DIWikiPage::newFromText('Foo'));
$property = new DIProperty('Foo');
$container = $instance->getContainerFor($property, array('Some error'));
$this->assertNotSame($container->getHash(), $instance->getContainerFor($property, array('Different error'))->getHash());
}
示例3: testGetHash
public function testGetHash()
{
$diff = array();
$instance = new CompositePropertyTableDiffIterator($diff);
$instance->setSubject(DIWikiPage::newFromText(__METHOD__));
$this->assertInternalType('string', $instance->getHash());
}
示例4: testCreateProfile
/**
* @dataProvider durationDataProvider
*/
public function testCreateProfile($duration, $expected)
{
$profiler = new NullProfileAnnotator(new Subobject(DIWikiPage::newFromText(__METHOD__)->getTitle()), 'foo');
$instance = new DurationProfileAnnotator($profiler, $duration);
$instance->addAnnotation();
$this->semanticDataValidator->assertThatPropertiesAreSet($expected, $instance->getContainer()->getSemanticData());
}
示例5: testRun
public function testRun()
{
$parameters = array('slot:id' => 42);
$this->transitionalDiffStore->expects($this->once())->method('delete');
$subject = DIWikiPage::newFromText(__METHOD__);
$instance = new ChronologyPurgeJob($subject->getTitle(), $parameters);
$this->assertTrue($instance->run());
}
示例6: testCreateProfile
public function testCreateProfile()
{
$profiler = new NullProfileAnnotator(new Subobject(DIWikiPage::newFromText(__METHOD__)->getTitle()), 'foo');
$instance = new FormatProfileAnnotator($profiler, 'table');
$instance->addAnnotation();
$expected = array('propertyCount' => 1, 'propertyKeys' => array('_ASKFO'), 'propertyValues' => array('table'));
$this->semanticDataValidator->assertThatPropertiesAreSet($expected, $instance->getContainer()->getSemanticData());
}
示例7: testAddAnotherToEntityList
/**
* @depends testAddToEntityList
*/
public function testAddAnotherToEntityList()
{
$dataItem = DIWikiPage::newFromText('Bar');
$this->query->expects($this->any())->method('getQueryId')->will($this->returnValue('FOO:BAR'));
$instance = new EntityListAccumulator($this->query);
$instance->addToEntityList($dataItem);
$this->assertEquals(array('FOO:BAR' => array('Bar#0#' => $dataItem)), $instance->getEntityList());
}
示例8: dataItemDataProvider
public function dataItemDataProvider()
{
// Single
$subject = array(DIWikiPage::newFromText(__METHOD__));
// Multiple
$subjects = array(DIWikiPage::newFromText(__METHOD__ . 'm-0'), DIWikiPage::newFromText(__METHOD__ . 'm-1'), DIWikiPage::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)));
}
示例9: testGetHash
public function testGetHash()
{
$instance = new SemanticData(DIWikiPage::newFromText(__METHOD__));
$instance->addDataValue(DataValueFactory::getInstance()->newDataValueByText('Has fooQuex', 'Bar'));
$subobject = $this->newSubobject($instance->getSubject()->getTitle());
$instance->addPropertyObjectValue($subobject->getProperty(), $subobject->getContainer());
$this->assertInternalType('string', $instance->getHash());
}
示例10: setUp
protected function setUp()
{
parent::setUp();
$idTable = $this->getMockBuilder('\\stdClass')->setMethods(array('getDataItemById'))->getMock();
$idTable->expects($this->any())->method('getDataItemById')->will($this->returnValue(DIWikiPage::newFromText('Foo')));
$this->store = $this->getMockBuilder('\\SMW\\SQLStore\\SQLStore')->disableOriginalConstructor()->getMock();
$this->store->expects($this->any())->method('getObjectIds')->will($this->returnValue($idTable));
}
示例11: testPreliminaryCheckForType
/**
* @dataProvider preliminaryCheckProvider
*/
public function testPreliminaryCheckForType($type, $parameters = array())
{
$httpRequest = $this->getMockBuilder('\\Onoi\\HttpRequest\\SocketRequest')->disableOriginalConstructor()->getMock();
$httpRequest->expects($this->any())->method('ping')->will($this->returnValue(true));
$instance = new DeferredRequestDispatchManager($httpRequest);
$instance->reset();
$this->assertNull($instance->dispatchJobRequestFor($type, DIWikiPage::newFromText(__METHOD__)->getTitle(), $parameters));
}
示例12: testNoAnnotationWhenDisabled
public function testNoAnnotationWhenDisabled()
{
$semanticData = $this->semanticDataFactory->newEmptySemanticData(DIWikiPage::newFromText('Foo'));
$instance = new DisplayTitlePropertyAnnotator(new NullPropertyAnnotator($semanticData), 'Bar');
$instance->canCreateAnnotation(false);
$instance->addAnnotation();
$expected = array('propertyCount' => 0);
$this->semanticDataValidator->assertThatPropertiesAreSet($expected, $instance->getSemanticData());
}
示例13: testDisabledSubcategoryLookup
public function testDisabledSubcategoryLookup()
{
$store = $this->getMockBuilder('\\SMW\\Store')->disableOriginalConstructor()->getMockForAbstractClass();
$cache = $this->getMockBuilder('\\Onoi\\Cache\\Cache')->disableOriginalConstructor()->getMock();
$cache->expects($this->never())->method('contains')->will($this->returnValue(false));
$instance = new PropertyHierarchyLookup($store, $cache);
$instance->setSubcategoryDepth(0);
$this->assertFalse($instance->hasSubcategoryFor(DIWikiPage::newFromText('Foo', NS_CATEGORY)));
}
示例14: testFindRedirectTargetOnSelfReferencedDataItem
public function testFindRedirectTargetOnSelfReferencedDataItem()
{
$store = $this->getMockBuilder('\\SMW\\Store')->disableOriginalConstructor()->setMethods(array('getRedirectTarget'))->getMockForAbstractClass();
$store->expects($this->never())->method('getRedirectTarget');
$circularReferenceGuard = $this->getMockBuilder('\\SMW\\CircularReferenceGuard')->disableOriginalConstructor()->getMock();
$circularReferenceGuard->expects($this->atLeastOnce())->method('isCircularByRecursionFor')->will($this->returnValue(true));
$instance = new RedirectTargetLookup($store, $circularReferenceGuard);
$instance->findRedirectTarget(DIWikiPage::newFromText('Foo'));
}
示例15: testGetPropertyValuesFromCache
public function testGetPropertyValuesFromCache()
{
$container = $this->getMockBuilder('\\Onoi\\BlobStore\\Container')->disableOriginalConstructor()->getMock();
$container->expects($this->atLeastOnce())->method('has')->will($this->returnValue(true));
$container->expects($this->once())->method('get')->with($this->stringContains('Bar:123'))->will($this->returnValue(1001));
$this->blobStore->expects($this->atLeastOnce())->method('read')->will($this->returnValue($container));
$instance = new CachedPropertyValuesPrefetcher($this->store, $this->blobStore);
$this->assertEquals(1001, $instance->getPropertyValues(DIWikiPage::newFromText('Foo#123'), new DIProperty('Bar')));
}