/**
  * @link http://clangers.collectiveaccess.org/jira/browse/PROV-1026
  */
 public function testDataExporterCanLoadFromFile()
 {
     $t_locale = new ca_locales();
     $va_locales = $t_locale->getLocaleList();
     $vn_locale_id = key($va_locales);
     $t_exporter = new ca_data_exporters();
     $va_errors = array();
     ca_data_exporters::loadExporterFromFile(__DIR__ . '/data/list_item_export_mapping.xlsx', $va_errors, array('locale_id' => $vn_locale_id));
     $vo_exporter = ca_data_exporters::loadExporterByCode('testmappingforunittests');
     $this->assertEmpty($va_errors, 'Should be no error messages');
     $this->assertTrue(is_object($vo_exporter), 'Should have found an exporter by the correct name');
     $this->assertInstanceOf('ca_data_exporters', $vo_exporter, 'Incorrect type loaded');
     $vo_exporter->setMode(ACCESS_WRITE);
     $vo_exporter->delete(true, array('hard' => true));
     $vo_exporter = $t_exporter->load(array('exporter_code' => 'testmappingforunittests'));
     $this->assertFalse($vo_exporter, 'Should no longer have an exporter loaded');
 }
 public static function loadExporterByCode($ps_exporter_code)
 {
     if (isset(ca_data_exporters::$s_exporter_cache[$ps_exporter_code])) {
         return ca_data_exporters::$s_exporter_cache[$ps_exporter_code];
     } else {
         $t_exporter = new ca_data_exporters();
         if ($t_exporter->load(array('exporter_code' => $ps_exporter_code))) {
             return ca_data_exporters::$s_exporter_cache[$ps_exporter_code] = $t_exporter;
         }
     }
     return false;
 }