Add test for skipping empty rows

This commit is contained in:
Adrien Loison 2015-04-03 22:45:09 -07:00
parent 66e5792a7e
commit 93cdd398dd

View File

@ -76,6 +76,22 @@ class CSVTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('csv--11,,csv--13', $writtenContent, 'The null values should be replaced by empty values');
}
/**
* @return void
*/
public function testWriteShouldSkipEmptyRows()
{
$allRows = [
['csv--11', 'csv--12'],
[],
['csv--31', 'csv--32'],
];
$writtenContent = $this->writeToCsvFileAndReturnWrittenContent($allRows, 'csv_with_empty_rows.csv');
$writtenContent = $this->trimWrittenContent($writtenContent);
$this->assertEquals("csv--11,csv--12\ncsv--31,csv--32", $writtenContent, 'Empty rows should be skipped');
}
/**
* @return void
*/