diff --git a/Service/ExcelWriter.php b/Service/ExcelWriter.php index e5bfce4..64ce158 100644 --- a/Service/ExcelWriter.php +++ b/Service/ExcelWriter.php @@ -44,7 +44,7 @@ public function setup($author = '', $title = '') public function setWorksheet($index, $title) { $this->handle->createSheet($index); - $this->resetCurrentRow(0); + $this->resetCurrentRow(1); $this->handle->setActiveSheetIndex($index); $this->setSheetTitle($title); } diff --git a/Tests/Service/ExcelWriterTest.php b/Tests/Service/ExcelWriterTest.php index 08740de..559088f 100644 --- a/Tests/Service/ExcelWriterTest.php +++ b/Tests/Service/ExcelWriterTest.php @@ -56,7 +56,10 @@ public function testShouldSetCurrentWorksheet() $this->phpExcelHandleMock->expects($this->once())->method('createSheet')->with($index); $this->phpExcelHandleMock->expects($this->once())->method('setActiveSheetIndex')->with($index); - $this->buildService()->setWorksheet($index, $title); + $service = $this->buildService(); + + $service->setWorksheet($index, $title); + $this->assertAttributeEquals(1, 'currentRow', $service, 'Row should be reset to 1 when switching active sheets'); } public function testShouldWriteSingleRowHeaders()