/** * @dataProvider stringValueProvider */ public function testFormat($stringValue, $type, $linker, $expected) { $monolingualTextValue = new MonolingualTextValue(); $monolingualTextValue->setUserValue($stringValue); $instance = new MonolingualTextValueFormatter($monolingualTextValue); $this->assertEquals($expected, $instance->format($type, $linker)); }
/** * @dataProvider valueProvider */ public function testDeserialize($value, $decription, $queryString, $dvFeatures) { $monolingualTextValue = new MonolingualTextValue(); $monolingualTextValue->setOptions(new Options(array('smwgDVFeatures' => $dvFeatures))); $instance = new MonolingualTextValueDescriptionDeserializer(); $instance->setDataValue($monolingualTextValue); $this->assertInstanceOf($decription, $instance->deserialize($value)); $this->assertEquals($queryString, $instance->deserialize($value)->getQueryString()); }
public function testGetTextWithLanguageTag() { $instance = new MonolingualTextValue(); $this->assertSame('foo@zh-Hans', $instance->getTextWithLanguageTag('foo', 'zh-hans')); }