public function processShouldApplyValueConverterIfFieldFilterReturnsTrueToReadItems()
{
$iterator = m::mock('\\Iterator');
$iterator->shouldReceive('rewind');
$iterator->shouldReceive('valid')->andReturn(true)->once();
$iterator->shouldReceive('current')->andReturn(['foo' => 'foobar', 'bar' => 'baz']);
$iterator->shouldReceive('next');
$iterator->shouldReceive('valid')->andReturn(false)->once();
$reader = $this->getMockReader();
$reader->shouldReceive('getIterator')->andReturn($iterator);
$converter = $this->getMockConverter();
$converter->shouldReceive('convert')->with('foobar')->once()->andReturn('FOOBAR');
$filter = $this->getMockFilter();
$filter->shouldReceive('filter')->with('baz')->once()->andReturn(true);
$this->workflow->addConverter(['field' => 'foo', 'converter' => $converter, 'filter' => $filter, 'filterField' => 'bar']);
$writer = $this->getMockWriter();
$writer->shouldReceive('prepare');
$writer->shouldReceive('writeItem')->with(['foo' => 'FOOBAR', 'bar' => 'baz'])->once();
$writer->shouldReceive('finish');
$this->workflow->addWriter($writer);
$result = $this->workflow->process($reader);
$this->assertEquals(1, $result->getReadCount());
}