/** * @param VoteOption $command */ public function handleVoteOption(VoteOption $command) { $pollId = $command->getPollId(); $optionNumber = $command->getOptionNumber(); /** @var Poll $poll */ $poll = $this->repository->load($pollId); $poll->vote($optionNumber); $this->repository->add($poll); }
/** * @test * @group unit */ public function option_number_is_returned() { $id = new PollId(); $command = new VoteOption($id, 42); $this->assertSame(42, $command->getOptionNumber()); }