Exemplo n.º 1
0
 /**
  * @param CreatePoll $command
  */
 public function handleCreatePoll(CreatePoll $command)
 {
     $id = $command->getPollId();
     $name = $command->getTitle();
     $poll = Poll::create($id, $name);
     $this->repository->add($poll);
 }
Exemplo n.º 2
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());
 }