/**
  * Validate that the export resets state appropriately
  */
 public function test_export_resetsstate()
 {
     global $CFG;
     $file = get_plugin_directory('dhexport', 'version1elis') . '/version1elis.class.php';
     require_once $file;
     // Data setup.
     $this->load_csv_data();
     // Set the export to be incremental.
     set_config('nonincremental', 0, 'dhexport_version1elis');
     // Plugin for file IO.
     $fileplugin = new rlip_fileplugin_export();
     $fileplugin->open(RLIP_FILE_WRITE);
     // Our specific export.
     $exportplugin = new rlip_exportplugin_version1elis($fileplugin, true);
     $exportplugin->init(0, 0);
     // Validate setup.
     $this->assertTrue($exportplugin->recordset->valid());
     $exportplugin->close();
     // Validate result.
     $this->assertNull($exportplugin->recordset);
     $fileplugin->close();
 }
 /**
  * Fetches our export data as a multi-dimensional array.
  *
  * @param bool $manual          Whether this is a manual run.
  * @param int  $targetstarttime The timestamp representing the theoretical time when this task was meant to be run
  * @param int  $lastruntime     The last time the export was run (required for incremental scheduled export)
  *
  * @return array The export data
  */
 protected function get_export_data($manual = true, $targetstarttime = 0, $lastruntime = 0)
 {
     global $CFG;
     $file = get_plugin_directory('dhexport', 'version1elis') . '/version1elis.class.php';
     require_once $file;
     // Set the export to be incremental.
     set_config('nonincremental', 0, 'dhexport_version1elis');
     // Set the incremental time delta.
     set_config('incrementaldelta', '1d', 'dhexport_version1elis');
     // Plugin for file IO.
     $fileplugin = new rlip_fileplugin_export();
     $fileplugin->open(RLIP_FILE_WRITE);
     // Our specific export.
     $exportplugin = new rlip_exportplugin_version1elis($fileplugin, $manual);
     $exportplugin->init($targetstarttime, $lastruntime);
     $exportplugin->export_records(0);
     $exportplugin->close();
     $fileplugin->close();
     return $fileplugin->get_data();
 }