public function testMap()
{
$records = $this->porter->setMapper(\Mockery::mock(CollectionMapper::class)->shouldReceive('mapCollection')->with(\Mockery::type(\Iterator::class), $mapping = \Mockery::type(Mapping::class), \Mockery::any())->once()->andReturn(new \ArrayIterator($result = ['foo' => 'bar']))->getMock())->import($this->specification->setMapping(\Mockery::mock(Mapping::class)));
self::assertInstanceOf(PorterRecords::class, $records);
self::assertSame($result, iterator_to_array($records));
/** @var MappedRecords $previous */
self::assertInstanceOf(MappedRecords::class, $previous = $records->getPreviousCollection());
self::assertNotSame($mapping, $previous->getMapping(), 'Mapping was not cloned.');
}