public function testDump() { $input = array(array('key1' => 'value 1', 'key2' => 2.0), array('key1' => 'value2', 'key2' => 3)); $output = "key1;key2\r\n\"value 1\";2.00\r\nvalue2;3"; $dumper = new Csv\Dumper(); $this->assertEquals($output, $dumper->dump($input)); }
/** * @param array $array * @param array $options * @return string */ public static function dump(array $array, array $options = array()) { $default_options = array('delimiter' => ';', 'encoding_source' => 'UTF-8', 'encoding_target' => 'UTF-8', 'header' => true, 'number_format_decimals' => 2, 'number_format_dec_point' => '.', 'number_format_thousands_sep' => ''); $options = array_merge($default_options, $options); $csv = new Csv\Dumper(); return $csv->dump($array, $options['delimiter'], $options); }