コード例 #1
0
 public function setUp()
 {
     $this->testHelper = new TestHelper($this);
     $aggregateId = BasketId::fromString('some-id');
     $this->eventId = $this->testHelper->mockIdentifier();
     $this->event = $this->testHelper->mockEvent();
     $this->envelope = EventEnvelope::envelop($this->eventId, 'some.name', $this->event, $aggregateId, 123);
 }
コード例 #2
0
 /**
  * @test
  */
 public function itWrapsDomainEventsInAnEventStream()
 {
     $id = BasketId::fromString('some-id');
     $domainEvents = $this->testHelper->getDomainEvents($id);
     $this->eventIdGenerator->expects($this->exactly(3))->method('generate')->will($this->returnValue($this->testHelper->mockIdentifier()));
     $this->eventNameResolver->expects($this->exactly(3))->method('resolveEventName')->with($this->isInstanceOf('SimpleES\\EventSourcing\\Event\\DomainEvent'));
     $envelopeStream = $this->eventWrapper->wrap($id, $domainEvents);
     $this->assertInstanceOf('SimpleES\\EventSourcing\\Event\\EventStream', $envelopeStream);
     $this->assertCount(3, $envelopeStream);
 }