Example #1
0
 /**
  * @test
  * @group integration
  */
 public function new_poll_is_saved_and_loaded_through_eventstore()
 {
     $id = new PollId();
     $poll = Poll::create($id, 'Poll title');
     $this->repository->add($poll);
     $loadedPoll = $this->repository->load($id);
     $this->assertEquals($id, $loadedPoll->getAggregateRootId());
 }
Example #2
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);
 }