update xlsx writer

This commit is contained in:
Salavat Salakhutdinov committed 2020-10-30 18:46:52 +03:00
1 parent ab973cab34
commit 7f26167be8
3 files changed
+79 -8

No files matched your search

+27
View File
@@ -189,6 +189,33 @@ class WriterTest extends TestCase
$this->assertEquals($sheets[1], $writer->getCurrentSheet(), 'The current sheet should be the second one.');
}
/**
* @return void
*/
public function testCellFormula()
{
$fileName = 'test_cell_formula.xlsx';
$rowsAsArray = [
[[1], [3], ['Github link', 'HYPERLINK("https://github.com/","Github link")']],
[[0, 'A1+B1'], [-2, 'A1-B1'], ['Google link', 'HYPERLINK("https://google.com/","Google link")'], ['test']],
];
$rows = array_map(function($rowAsArray) {
return WriterEntityFactory::createRow((array_map(function($cellAsArray) {
return new Cell($cellAsArray[0] ?? "", null, $cellAsArray[1] ?? "");
}, $rowAsArray)));
}, $rowsAsArray);
$this->writeToXLSXFile($rows, $fileName);
foreach ($rows as $row) {
foreach ($row->getCells() as $cell) {
$this->assertInlineDataWasWrittenToSheet($fileName, 1, $cell->getValue());
$this->assertInlineDataWasWrittenToSheet($fileName, 1, $cell->getFormula());
}
}
}
/**
* @return void
*/