コード例 #1
0
 /**
  * @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);
 }
コード例 #2
0
ファイル: VoteOptionTest.php プロジェクト: cdspuglia/pollo
 /**
  * @test
  * @group unit
  */
 public function poll_id_is_returned()
 {
     $id = new PollId();
     $command = new VoteOption($id, 42);
     $this->assertSame($id, $command->getPollId());
 }