/** * @test */ public function it_handles_rebuilding_projections() { $stream = $this->prophesize(EventStreamInterface::class); $this->eventStore->loadAll()->willReturn($stream); $this->projectionManager->clear()->shouldBeCalled(); $this->projectionManager->notify($stream)->shouldBeCalled(); $this->command->handle($this->projectionManager->reveal(), $this->eventStore->reveal()); }
/** * @param ProjectionManager $projectionManager * @param EventStoreInterface $eventStore * @return void */ public function handle(ProjectionManager $projectionManager, EventStoreInterface $eventStore) { $eventStream = $eventStore->loadAll(); $projectionManager->clear(); $projectionManager->notify($eventStream); }
/** * @param User $user * @return void */ public function save(User $user) { $recordedEvents = $user->getRecordedEvents(); $this->eventStore->append($recordedEvents); $this->projectionManager->notify($recordedEvents); }