public function testVisitAllEvents()
 {
     $eventVisitor = $this->getMock(EventVisitorInterface::class);
     $eventVisitor->expects($this->exactly(100))->method('doWithEvent');
     $this->testSubject->appendEvents('type1', new SimpleDomainEventStream($this->createDomainEvents(77)));
     $this->testSubject->appendEvents('type2', new SimpleDomainEventStream($this->createDomainEvents(23)));
     $this->testSubject->visitEvents($eventVisitor);
 }
 public function testStoreDuplicateAggregate()
 {
     $this->testSubject->appendEvents("type1", new SimpleDomainEventStream([new GenericDomainEventMessage("aggregate1", 0, new \stdClass())]));
     try {
         $this->testSubject->appendEvents("type1", new SimpleDomainEventStream([new GenericDomainEventMessage("aggregate1", 0, new \stdClass())]));
         $this->fail("Expected exception to be thrown");
     } catch (ConcurrencyException $ex) {
         $this->assertNotNull($ex);
     }
 }