/** * @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"); } }
/** * @expectedException \Nomnom\UnitNotFoundException * @expectedExceptionMessage Unit "XB" not found */ public function test_unknown_metric_throws_exception() { UnitResolver::resolve("XB"); }