/** * @param CreateOption $command */ public function handleCreateOption(CreateOption $command) { $pollId = $command->getPollId(); $optionName = $command->getName(); /** @var Poll $poll */ $poll = $this->repository->load($pollId); $poll->createOption($optionName); $this->repository->add($poll); }
/** * @test * @group unit */ public function option_name_is_returned() { $id = new PollId(); $command = new CreateOption($id, 'Name'); $this->assertSame('Name', $command->getName()); }