Files
oleibman 378beac8f2 Xls Writer Parser Handle Boolean Literals as Function Arguments (#3391)
Fix #3369. The parser had failed to account for `TRUE` and `FALSE` when supplied as arguments to a function.

I had hoped to be able to do something about its inability to handle defined names as well. I failed. I think another section might need to be added to the Writer output which specifies the defined names. I haven't yet located any suitable documentation.
2023-02-23 10:54:54 -08:00

26 lines
900 B
PHP

<?php
namespace PhpOffice\PhpSpreadsheetTests\Writer\Xls;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheetTests\Functional\AbstractFunctional;
class BooleanLiteralTest extends AbstractFunctional
{
public function testBooleanLiteral(): void
{
// Issue 3369 - Xls Writer Parser unable to handle
// TRUE (or FALSE) when specified as function arguments.
$formula = '=AND(true,true(),fAlse,false())';
$spreadsheet = new Spreadsheet();
$spreadsheet->setActiveSheetIndex(0);
$spreadsheet->getActiveSheet()->setCellValue('A1', $formula);
$robj = $this->writeAndReload($spreadsheet, 'Xls');
$spreadsheet->disconnectWorksheets();
$sheet0 = $robj->setActiveSheetIndex(0);
self::assertSame(strtoupper($formula), $sheet0->getCell('A1')->getValue());
$robj->disconnectWorksheets();
}
}