public function testGetWikiValueForLengthOf()
 {
     $instance = new StringValue('_txt');
     $instance->setUserValue('abcdefあいうエオ');
     $this->assertEquals('abcdefあい', $instance->getWikiValueForLengthOf(8));
     $this->assertEquals('abcdefあいうエオ', $instance->getWikiValueForLengthOf(14));
 }
 /**
  * @dataProvider stringValueProvider
  */
 public function testFormat($stringUserValue, $type, $linker, $expected)
 {
     $stringValue = new StringValue('_cod');
     $stringValue->setUserValue($stringUserValue);
     $instance = new CodeStringValueFormatter($stringValue);
     $this->assertEquals($expected, $instance->format($type, $linker));
 }
 public function testFormatWithReducedLength()
 {
     // > 255 / Reduced length
     $text = 'Lorem ipsum dolor sit amet consectetuer justo Nam quis lobortis vel. Sapien nulla enim Lorem enim pede ' . 'lorem nulla justo diam wisi. Libero Nam turpis neque leo scelerisque nec habitasse a lacus mattis. Accumsan ' . 'tincidunt Sed adipiscing nec facilisis tortor Nunc Sed ipsum tellus';
     $expected = 'Lorem ipsum dolor sit amet consectetuer …';
     $stringValue = new StringValue('_txt');
     $stringValue->setUserValue($text);
     $stringValue->setOutputFormat(40);
     $instance = new StringValueFormatter($stringValue);
     $this->assertEquals($expected, $instance->format(StringValueFormatter::HTML_LONG));
     $this->assertEquals($expected, $instance->format(StringValueFormatter::WIKI_SHORT));
 }
 public function testGetInfolinkTextOnStringValueWithServiceLinks()
 {
     $service = 'testGetInfolinkTextOnStringValueWithServiceLinks';
     $this->cachedPropertyValuesPrefetcher->expects($this->atLeastOnce())->method('getPropertyValues')->will($this->returnValue(array($this->dataItemFactory->newDIBlob($service))));
     // Manipulating the Message cache is a hack!!
     $parameters = array("smw_service_" . $service, 'Bar');
     Message::getCache()->save(Message::getHash($parameters, Message::TEXT, Message::CONTENT_LANGUAGE), 'SERVICELINK-A|SERVICELINK-B');
     $stringValue = new StringValue('_txt');
     $stringValue->setOption(StringValue::OPT_USER_LANGUAGE, 'en');
     $stringValue->setOption(StringValue::OPT_CONTENT_LANGUAGE, 'en');
     $stringValue->setProperty($this->dataItemFactory->newDIProperty('Foo'));
     $stringValue->setUserValue('Bar');
     $instance = new InfoLinksProvider($stringValue);
     $this->assertContains('<div class="smwttcontent">&#x005B;SERVICELINK-B SERVICELINK-A]</div>', $instance->getInfolinkText(SMW_OUTPUT_WIKI));
     $this->assertContains('<div class="smwttcontent"><a href="SERVICELINK-B">SERVICELINK-A</a></div>', $instance->getInfolinkText(SMW_OUTPUT_HTML));
 }