From 93cdd398dd46d04e91e248ca1f235174e0620ec5 Mon Sep 17 00:00:00 2001 From: Adrien Loison Date: Fri, 3 Apr 2015 22:45:09 -0700 Subject: [PATCH] Add test for skipping empty rows --- tests/Spout/Writer/CSVTest.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/Spout/Writer/CSVTest.php b/tests/Spout/Writer/CSVTest.php index bfbc71f0..2d1b2071 100644 --- a/tests/Spout/Writer/CSVTest.php +++ b/tests/Spout/Writer/CSVTest.php @@ -76,6 +76,22 @@ public function testWriteShouldSupportNullValues() $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 */