/**
  * @test
  * @expectedException \SimpleES\EventSourcing\Exception\IdNotMappedToAggregate
  */
 public function itCannotReconstituteAnAggregateWhenMapNotFound()
 {
     $factory = new MappingAggregateFactory([]);
     $id = BasketId::fromString('some-id');
     $aggregateHistory = $this->testHelper->getAggregateHistory($id);
     $factory->reconstituteFromHistory($aggregateHistory);
 }
 /**
  * @test
  */
 public function itReconstitutesAnAggregateFromHistoryRetrievedFromTheEventStore()
 {
     $id = BasketId::fromString('some-basket');
     $eventStream = $this->testHelper->getEventStream($id);
     $aggregateHistory = $this->testHelper->getAggregateHistory($id);
     $aggregate = Basket::pickUp($id);
     $this->eventStore->expects($this->once())->method('read')->with($this->equalTo($id))->will($this->returnValue($eventStream));
     $this->eventWrapper->expects($this->once())->method('unwrap')->with($this->equalTo($eventStream))->will($this->returnValue($aggregateHistory));
     $this->aggregateFactory->expects($this->once())->method('reconstituteFromHistory')->with($this->equalTo($aggregateHistory))->will($this->returnValue($aggregate));
     $foundAggregate = $this->repository->get($id);
     $this->assertSame($aggregate, $foundAggregate);
 }