示例#1
0
 /**
  * @param $unit
  * @throws ConversionException
  */
 protected function setBase($unit)
 {
     if ($this->shouldSetBaseTen($unit)) {
         $this->base = 10;
     }
     if (UnitResolver::unitsAreDifferent($this->from, $unit)) {
         throw new ConversionException("Cannot convert between metric and binary formats");
     }
 }
示例#2
0
 /**
  * @expectedException \Nomnom\UnitNotFoundException
  * @expectedExceptionMessage Unit "XB" not found
  */
 public function test_unknown_metric_throws_exception()
 {
     UnitResolver::resolve("XB");
 }