Commit 4c94aaa7 authored by edysmp's avatar edysmp Committed by heddn

Issue #2954413 by edysmp, quietone: Add getter for file

parent 0919c4e9
......@@ -171,6 +171,16 @@ class CSV extends SourcePluginBase implements ConfigurablePluginInterface {
return $this->configuration;
}
/**
* Gets the file object.
*
* @return \SplFileObject
* The file object.
*/
public function getFile() {
return $this->file;
}
/**
* {@inheritdoc}
*/
......
......@@ -256,6 +256,24 @@ class CSVUnitTest extends CSVUnitBase {
$this->assertArrayEquals($expected, $csv->getIds());
}
/**
* Test the getFile return a valid file instance.
*
* @covers ::getFile
*/
public function testGetFile() {
$configuration = [
'path' => $this->happyPath,
'keys' => ['id'],
'header_row_count' => 1,
];
$csv = new CSV($configuration, $this->pluginId, $this->pluginDefinition, $this->migration);
$csv->initializeIterator();
$file = $csv->getFile();
$this->assertInstanceOf(\SplFileObject::class, $file);
}
/**
* Tests that fields have a machine name and description.
*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment