public function testAddCsvDataMetadataManipulator() { $settings = array('FETCHER' => array('class' => 'Csv', 'input_file' => dirname(__FILE__) . '/assets/csv/sample_metadata.csv', 'temp_directory' => $this->path_to_temp_dir, 'record_key' => 'ID', 'use_cache' => false), 'LOGGING' => array('path_to_log' => $this->path_to_log, 'path_to_manipulator_log' => $this->path_to_manipulator_log), 'METADATA_PARSER' => array('mapping_csv_path' => dirname(__FILE__) . '/assets/csv/sample_mappings.csv'), 'MANIPULATORS' => array('metadatamanipulators' => array('AddCsvData'))); $parser = new CsvToMods($settings); $mods = $parser->metadata('postcard_20'); $this->assertRegExp('#<CSVRecord.*"Date":"1907"#', $mods, "AddCsvData metadata manipulator did not work"); }
public function testCsvToModsMetadataParser() { $settings = array('FETCHER' => array('input_file' => dirname(__FILE__) . '/assets/csv/sample_metadata.csv', 'temp_directory' => $this->path_to_temp_dir, 'record_key' => 'ID', 'use_cache' => false), 'LOGGING' => array('path_to_log' => $this->path_to_log), 'METADATA_PARSER' => array('mapping_csv_path' => dirname(__FILE__) . '/assets/csv/sample_mappings.csv', 'repeatable_wrapper_elements' => array('subject'))); $parser = new CsvToMods($settings); $mods = $parser->metadata('postcard_10'); $dom = new \DOMDocument(); $dom->loadXML($mods); $this->assertTrue($dom->schemaValidate($this->path_to_mods_schema), "MODS document generate by CSV to MODS metadata parser did not validate"); $this->assertRegExp('#<geographic>Victoria, BC</geographic>#', $mods, "CSV to MODS metadata parser did not work"); }