function guts() { if (isset($_GET['go'])) { header(sprintf('Content-Disposition: attachment;filename="vaf-export-%s.csv"', time())); header('Content-Type: text/csv'); $exporter = new VF_Note_Export($_FILES['file']['tmp_name']); echo $exporter->export(); exit; } }
function testExport() { $finder = new VF_Note_Finder(); $noteId = $finder->insert('code1', 'message1'); $export = new VF_Note_Export(); $csv = $export->export(); $expected = '"id","code","message" "' . $noteId . '","code1","message1" '; $this->assertEquals($expected, $csv); }