Skip to content

Commit

Permalink
Unit test and reset row count to 1
Browse files Browse the repository at this point in the history
  • Loading branch information
rushi committed Aug 19, 2015
1 parent 0d4dd6f commit 382bbf7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Service/ExcelWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
5 changes: 4 additions & 1 deletion Tests/Service/ExcelWriterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 382bbf7

Please sign in to comment.