Merge 6572e713bf48de8e1e09670143584e4d60e2b3a7 into 5d4166196ad5bcde89f7316d273ef13eff144666
This commit is contained in:
commit
1fbf440253
@ -125,7 +125,7 @@ class Writer extends AbstractMultiSheetsWriter
|
||||
*/
|
||||
protected function closeWriter()
|
||||
{
|
||||
if ($this->book) {
|
||||
if ($this->book && $this->isWriterOpened) {
|
||||
$this->book->close($this->filePointer);
|
||||
}
|
||||
}
|
||||
|
@ -507,6 +507,19 @@ class WriterTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', $finfo->file($resourcePath));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function testCloseIsNotAppliedWhenWriterIsNotOpened()
|
||||
{
|
||||
/** @var \Box\Spout\Writer\XLSX\Writer $writer */
|
||||
$writer = WriterFactory::create(Type::XLSX);
|
||||
$writer->openToFile('test_close.xlsx');
|
||||
$writer->addRow(['foo']);
|
||||
$writer->close();
|
||||
$writer->close();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $allRows
|
||||
* @param string $fileName
|
||||
|
Loading…
x
Reference in New Issue
Block a user