public function processShouldReadFromMultipleReaders()
{
$iterator1 = m::mock('\\Iterator');
$iterator1->shouldReceive('rewind');
$iterator1->shouldReceive('valid')->andReturn(true)->once();
$iterator1->shouldReceive('current')->andReturn('foobar');
$iterator1->shouldReceive('next');
$iterator1->shouldReceive('valid')->andReturn(false)->once();
$reader1 = $this->getMockReader();
$reader1->shouldReceive('getIterator')->andReturn($iterator1);
$iterator2 = m::mock('\\Iterator');
$iterator2->shouldReceive('rewind');
$iterator2->shouldReceive('valid')->andReturn(true)->once();
$iterator2->shouldReceive('current')->andReturn('foobar');
$iterator2->shouldReceive('next');
$iterator2->shouldReceive('valid')->andReturn(false)->once();
$reader2 = $this->getMockReader();
$reader2->shouldReceive('getIterator')->andReturn($iterator2);
$writer = $this->getMockWriter();
$writer->shouldReceive('prepare')->once();
$writer->shouldReceive('finish')->once();
$writer->shouldReceive('writeItem')->with('foobar')->twice();
$this->workflow->addWriter($writer);
$result = $this->workflow->process([$reader1, $reader2]);
$this->assertEquals(2, $result->getReadCount());
$this->assertEquals(2, $result->getWriteCount());
$this->assertEquals(2, $result->getItemWriteCount());
}