/** * @dataProvider temperaturValueProvider */ public function testTemperaturFormat($numberUserValue, $type, $linker, $expected) { $temperatureValue = new TemperatureValue('_num'); $temperatureValue->setUserValue($numberUserValue); $temperatureValue->setOption('user.language', 'en'); $temperatureValue->setOption('content.language', 'en'); $instance = new NumberValueFormatter($temperatureValue); $this->assertEquals($expected, $instance->format($type, $linker)); }
public function testSetUserValueToReturnOnPreferredDisplayPrecision() { $this->propertySpecificationLookup->expects($this->once())->method('getDisplayPrecisionBy')->will($this->returnValue(0)); $instance = new TemperatureValue(); $instance->setProperty($this->dataItemFactory->newDIProperty('Foo')); $instance->setUserValue('100 °C'); $this->assertContains('373 K', $instance->getWikiValue()); $this->assertContains('100 °C', $instance->getShortWikiText()); $this->assertContains('373 K (100 °C, 212 °F, 672 °R)', $instance->getLongWikiText()); }