public function testItCanRegisterAnAggregateRoot() { $aggregateRoot = EventSourcedAggregateRootStub::createWithoutIdentifier(); $eventBus = new SimpleEventBus(); $callback = $this->getMock('RayRutjes\\DomainFoundation\\UnitOfWork\\SaveAggregateCallback'); $this->registeredAggregates->expects($this->once())->method('add')->with($this->identicalTo($aggregateRoot), $this->identicalTo($eventBus, $this->identicalTo($callback))); $this->assertSame($aggregateRoot, $this->unitOfWork->registerAggregate($aggregateRoot, $eventBus, $callback)); }
public function testCanReturnAnEmptyEventStreamIfThereAreNoPendingChanges() { $aggregateRoot = EventSourcedAggregateRootStub::createWithoutIdentifier(); $this->assertInstanceOf('RayRutjes\\DomainFoundation\\Domain\\Event\\Stream\\EventStream', $aggregateRoot->uncommittedChanges()); }