ODS Writer should accept associative arrays (#232)

This commit is contained in:
Adrien Loison committed 2016-05-25 19:59:18 -07:00
1 parent 2c80b1f23a
commit 2ed30321b4
4 files changed
+62 -4

No files matched your search

+20 -1
View File
@@ -21,7 +21,7 @@ class WriterTest extends \PHPUnit_Framework_TestCase
public function testAddRowShouldThrowExceptionIfCannotOpenAFileForWriting()
{
$fileName = 'file_that_wont_be_written.xlsx';
$this->createUnwritableFolderIfNeeded($fileName);
$this->createUnwritableFolderIfNeeded();
$filePath = $this->getGeneratedUnwritableResourcePath($fileName);
$writer = WriterFactory::create(Type::XLSX);
@@ -232,6 +232,25 @@ class WriterTest extends \PHPUnit_Framework_TestCase
}
}
/**
* @return void
*/
public function testAddRowShouldSupportAssociativeArrays()
{
$fileName = 'test_add_row_should_support_associative_arrays.xlsx';
$dataRows = [
['foo' => 'xlsx--11', 'bar' => 'xlsx--12'],
];
$this->writeToXLSXFile($dataRows, $fileName, $shouldUseInlineStrings = true);
foreach ($dataRows as $dataRow) {
foreach ($dataRow as $cellValue) {
$this->assertInlineDataWasWrittenToSheet($fileName, 1, $cellValue);
}
}
}
/**
* @return void
*/