public function testToInches() { $quantity = new Length(2, 'ft'); $this->assertEquals(24, $quantity->toUnit('in')); }
public function testToAstronomicalUnit() { $quantity = new Length(150000000, 'km'); $this->assertEquals(1.0026880683402668, $quantity->toUnit('AU')->getValue()); }
/** * Sets the $height property * * @since ##SINCE## * * @param float|int $height * @param string $unit Unit the height is in * Default: 'm' (meters) * * @return $this */ public function setHeight($height, $unit = 'm') { $height = new Length($height, $unit); $this->height = $height->toUnit('m'); $this->updateBMI(); return $this; }