protected function setUp() { $this->lockManager = $this->getMock('Simgroep\\EventSourcing\\Repository\\LockManager'); $this->repository = $this->getMock('Broadway\\Repository\\RepositoryInterface'); $this->aggregate = $this->getMock('Broadway\\Domain\\AggregateRoot'); $this->aggregate->expects($this->any())->method('getAggregateRootId')->will($this->returnValue('foo')); }
private function assertEvents(array $expectedEvents, AggregateRoot $organizer) { $domainMessages = iterator_to_array($organizer->getUncommittedEvents()->getIterator()); $payloads = array_map(function (DomainMessage $item) { return $item->getPayload(); }, $domainMessages); $this->assertEquals($expectedEvents, $payloads); }
private function decorateForWrite(AggregateRoot $aggregate, DomainEventStreamInterface $eventStream) { $aggregateIdentifier = $aggregate->getAggregateRootId(); foreach ($this->eventStreamDecorators as $eventStreamDecorator) { $eventStream = $eventStreamDecorator->decorateForWrite($this->aggregateClass, $aggregateIdentifier, $eventStream); } return $eventStream; }
private function decorateForWrite(AggregateRoot $aggregate, DomainEventStream $eventStream) { $aggregateType = $this->getType(); $aggregateIdentifier = $aggregate->getAggregateRootId(); foreach ($this->eventStreamDecorators as $eventStreamDecorator) { $eventStream = $eventStreamDecorator->decorateForWrite($aggregateType, $aggregateIdentifier, $eventStream); } return $eventStream; }