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


PHP SMWPropertyValue::setUserValue方法代码示例

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


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

示例1: testFormatWithPreferredLabel

 /**
  * @dataProvider preferredLabelValueProvider
  */
 public function testFormatWithPreferredLabel($property, $preferredLabel, $type, $linker, $expected)
 {
     // Ensures the mocked instance is injected and registered with the
     // PropertyRegistry instance
     \SMW\PropertyRegistry::clear();
     $this->propertyLabelFinder = $this->getMockBuilder('\\SMW\\PropertyLabelFinder')->disableOriginalConstructor()->getMock();
     $this->propertyLabelFinder->expects($this->any())->method('findPropertyListByLabelAndLanguageCode')->will($this->returnValue(array()));
     $this->propertyLabelFinder->expects($this->any())->method('findPreferredPropertyLabelByLanguageCode')->will($this->returnValue($preferredLabel));
     $this->propertyLabelFinder->expects($this->any())->method('searchPropertyIdByLabel')->will($this->returnValue(false));
     $this->testEnvironment->registerObject('PropertyLabelFinder', $this->propertyLabelFinder);
     $propertyValue = new PropertyValue();
     $propertyValue->setOption('smwgDVFeatures', SMW_DV_PROV_LHNT);
     $propertyValue->setOption(PropertyValue::OPT_CONTENT_LANGUAGE, 'en');
     $propertyValue->setOption(PropertyValue::OPT_USER_LANGUAGE, 'en');
     $propertyValue->setUserValue($property);
     $instance = new PropertyValueFormatter($propertyValue);
     $expected = $this->testEnvironment->getLocalizedTextByNamespace(SMW_NS_PROPERTY, $expected);
     $this->assertEquals($expected, $instance->format($type, $linker));
     \SMW\PropertyRegistry::clear();
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:23,代码来源:PropertyValueFormatterTest.php

示例2: makeUserProperty

 /**
  * Static function for creating a new property object from a
  * propertyname (string) as a user might enter it.
  * @note The resulting property object might be invalid if
  * the provided name is not allowed. An object is returned
  * in any case.
  *
  * @param string $propertyName
  *
  * @return SMWPropertyValue
  */
 public static function makeUserProperty($propertyName)
 {
     $property = new SMWPropertyValue('__pro');
     $property->setUserValue($propertyName);
     return $property;
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:17,代码来源:SMW_DV_Property.php


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