/** * @expectedException \InvalidArgumentException * @expectedExceptionMessage wrongColumnsNumber */ public function testRewind() { $this->_directoryMock->expects($this->any())->method('openFile')->will($this->returnValue(new \Magento\Framework\Filesystem\File\Read(__DIR__ . '/_files/test.csv', new \Magento\Framework\Filesystem\Driver\File()))); $model = new \Magento\ImportExport\Model\Import\Source\Csv(__DIR__ . '/_files/test.csv', $this->_directoryMock); $this->assertSame(-1, $model->key()); $model->next(); $this->assertSame(0, $model->key()); $model->next(); $this->assertSame(1, $model->key()); $model->rewind(); $this->assertSame(0, $model->key()); $model->next(); $model->next(); $this->assertSame(2, $model->key()); $model->current(); }