public function testExportCustomControls() { $csv = new CsvExport(); $response = $csv->__invoke('foo.csv', $this->header, $this->records, null, ';', "'"); $content = <<<CSV Year;Make;Model;Description;Price 1997;Ford;E350;'ac, abs, moon';3000.00 CSV; $this->assertEquals($content, $response->getContent()); }
public function testImport() { $csv = new CsvExport(); $header = array('Year', 'Make', 'Model', 'Description', 'Price'); $records = array(array('1997', 'Ford', 'E350', 'ac, abs, moon', '3000.00')); $response = $csv->__invoke('foo.csv', $header, $records); $type = $response->getHeaders()->get('Content-Type')->getFieldValue(); $this->assertEquals('text/csv', $type); $disposition = $response->getHeaders()->get('Content-Disposition')->getFieldValue(); $this->assertEquals('attachment;filename="foo.csv"', $disposition); $content = <<<CSV Year,Make,Model,Description,Price 1997,Ford,E350,"ac, abs, moon",3000.00 CSV; $this->assertEquals($content, $response->getContent()); }