Files
PhpSpreadsheet/tests/PhpSpreadsheetTests/Calculation/Discussion1950Test.php
T
2026-01-13 23:07:22 -08:00

37 lines
1.4 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
declare(strict_types=1);
namespace PhpOffice\PhpSpreadsheetTests\Calculation;
use PhpOffice\PhpSpreadsheet\Reader\Xlsx as XlsxReader;
use PHPUnit\Framework\TestCase;
class Discussion1950Test extends TestCase
{
public function testMultipleUnions(): void
{
$infile = 'tests/data/Reader/XLSX/discussion.1950.xlsx';
$reader = new XlsxReader();
$spreadsheet = $reader->load($infile);
$sheet = $spreadsheet->getActiveSheet();
self::assertSame('=SUM((A1,A2),(B1,B2))', $sheet->getCell('A5')->getValue());
//$sheet->getCell('A5')->setValue('=SUM((A1∪A2)∪(B1∪B2)))');
self::assertSame(10, $sheet->getCell('A5')->getCalculatedValue(), 'error out so use old calculated value');
$spreadsheet->disconnectWorksheets();
}
public function testUnexpectedUnion(): void
{
// was failing in a different manner than prior test
$infile = 'tests/data/Reader/XLSX/issue.4656.d.xlsx';
$reader = new XlsxReader();
$spreadsheet = $reader->load($infile);
$sheet = $spreadsheet->getActiveSheet();
self::assertSame('=RANK(A1,(A2,A3,A4))', $sheet->getCell('A5')->getValue());
//$sheet->getCell('A5')->setValue('=RANK(A1,(A2∪A3∪A4))');
self::assertSame(2, $sheet->getCell('A5')->getCalculatedValue(), 'error out so use old calculated value');
$spreadsheet->disconnectWorksheets();
}
}