function it_allows_to_reload_all_registered_projections(Projection $projection1, Projection $projection2, EventSubscribers $subscribers, Event $event, Event $secondEvent) { $subscribers->registerSubscriber(Argument::cetera())->willReturn(); $this->registerProjection('EventNameOccurred', $projection1); $this->registerProjection('EventNameOccurred', $projection2); $event->getName()->willReturn('EventNameOccurred'); $secondEvent->getName()->willReturn('OtherEventOccurred'); $this->clear(); $this->notify(new EventStream(new EventStream\Name('test'), [$event->getWrappedObject(), $secondEvent->getWrappedObject()])); $projection1->clear()->shouldHaveBeenCalled(); $projection2->clear()->shouldHaveBeenCalled(); $projection1->notify($event)->shouldHaveBeenCalled(); $projection2->notify($event)->shouldHaveBeenCalled(); }
function it_notify_subcribers_registered_for_given_event(Event $event, EventSubscriber $someEventOccuredSubcriber) { $event->getName()->willReturn('SomeEventOccured'); $this->notify(new EventStream(new EventStream\Name('test'), [$event->getWrappedObject()])); $someEventOccuredSubcriber->notify($event)->shouldHaveBeenCalled(); }