public function dont_test_it_ignores_invalid_events() { $events = array(EventMessage::record(new EventDouble('Event 1'), new EntityDTO('Entity', new Id(1))), 'event 2', EventMessage::record(new EventDouble('Event 3'), new EntityDTO('Entity', new Id(1)))); $Stream = new EventStream(); $Stream->load($events); $this->assertEquals(2, $Stream->count()); }
public function loadStream(EntityDTO $entity) { if (!$this->thereAreEventsForEntity($entity)) { throw new Exception\EntityNotFound(sprintf('No events found for entity: %s', $entity->getType()), 2); } $events = $this->getEventsForEntity($entity); $stream = new EventStream(); $stream->load($events); return $stream; }