예제 #1
0
 public function testToInches()
 {
     $quantity = new Length(2, 'ft');
     $this->assertEquals(24, $quantity->toUnit('in'));
 }
예제 #2
0
 public function testToAstronomicalUnit()
 {
     $quantity = new Length(150000000, 'km');
     $this->assertEquals(1.0026880683402668, $quantity->toUnit('AU')->getValue());
 }
예제 #3
0
 /**
  * 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;
 }