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