Files
oleibman 7f284c7d93 Deprecate FormulaParser, FormulaToken
Unused in this project. I checked to see if they might be of use for this PR. They aren't.
2026-01-19 12:38:56 -08:00

40 lines
1.0 KiB
PHP

<?php
declare(strict_types=1);
namespace PhpOffice\PhpSpreadsheetTests\Calculation;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PHPUnit\Framework\TestCase;
class Discussion1950Test extends TestCase
{
public function testMultipleUnions(): void
{
$spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet();
$sheet->fromArray([
[1, 2],
[3, 4],
]);
$sheet->setCellValue('A5', '=SUM((A1,A2),(B1,B2))');
self::assertSame(10, $sheet->getCell('A5')->getCalculatedValue());
$spreadsheet->disconnectWorksheets();
}
public function testUnexpectedUnion(): void
{
$spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet();
$sheet->fromArray([
[1],
[-1],
[2],
[1],
['=RANK(A1,(A2,A3,A4))'],
]);
self::assertSame(2, $sheet->getCell('A5')->getCalculatedValue());
$spreadsheet->disconnectWorksheets();
}
}