/** * Add a target * * @param Target $target * @return Targets * @throws InvalidArgumentException */ public function add(Target $target) { $name = $target->getName(); if (isset($this->{$name})) { throw new InvalidArgumentException("A target already exists with the name of '{$name}'"); } $this->targets[$name] = $target; return $this; }
/** * @covers Pants\Target\Target::getName * @covers Pants\Target\Target::setName */ public function testNameCanBeSet() { $this->target->setName('test'); $this->assertEquals('test', $this->target->getName()); }