fixes unparse bug if no data for unparsing remain (comments #150)

This commit is contained in:
Susann Sgorzaly
2018-11-13 19:10:10 +01:00
committed by Fonata
parent ab9e8a0af9
commit 52ad56c66a
2 changed files with 9 additions and 2 deletions

View File

@@ -81,6 +81,13 @@ class UnparseTest extends Testcase {
$this->unparseAndCompare($expected);
}
public function testUnparseDefaultWithoutData(){
unset($this->csv->data[0]);
unset($this->csv->data[1]);
$expected = "column1,column2\r";
$this->unparseAndCompare($expected);
}
private function unparseAndCompare($expected, $fields = array()) {
$str = $this->csv->unparse($this->csv->data, $fields);
$this->assertEquals($expected, $str);