public function setUnits($type) { if (!array_key_exists($type, $this->units)) { throw new \InvalidArgumentException("Invalid unit type"); } $this->unitType = $type; }
/** * @covers Location\Formatter\Coordinate\DMS::setUnits * @expectedException \InvalidArgumentException * @expectedExceptionMessage Invalid unit type */ public function testSetUnitsInvalidType() { $this->formatter->setUnits('invalid'); }