public function LengthTest::testConvert in Physical Fields 8
Tests unit conversion.
::covers convert.
File
- tests/
src/ Unit/ LengthTest.php, line 45
Class
- LengthTest
- Tests the length class.
Namespace
Drupal\Tests\physical\UnitCode
public function testConvert() {
$this
->assertEquals(new Length('3000', 'mm'), $this->length
->convert('mm')
->round());
$this
->assertEquals(new Length('300', 'cm'), $this->length
->convert('cm')
->round());
$this
->assertEquals(new Length('0.003', 'km'), $this->length
->convert('km')
->round(3));
$this
->assertEquals(new Length('118.110', 'in'), $this->length
->convert('in')
->round(3));
$this
->assertEquals(new Length('9.843', 'ft'), $this->length
->convert('ft')
->round(3));
$this
->assertEquals(new Length('0.00162', 'M'), $this->length
->convert('M')
->round(5));
}