mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-08-31 12:40:00 +00:00
e637713de9
When the Dynamic Array PR #3962 was introduced, it left the default as Return Array as Value. At some point, the default should be changed to Return Array as Array. This would, of course, be a breaking change, one which will not be part of Release 4. However, it will possibly be part of Release 5. Rather than relying on the default setting, this PR explicitly sets Return Array as Value when tests require that setting. This will make it easier to identify potential breaks when the default is changed. The entire test suite will now succeed with either setting as default. In making these changes, a few minor problems were discovered with how Array as Array is handled. These are fixed with this PR.
34 lines
1015 B
PHP
34 lines
1015 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Logical;
|
|
|
|
class XorTest extends AllSetupTeardown
|
|
{
|
|
#[\PHPUnit\Framework\Attributes\DataProvider('providerXOR')]
|
|
public function testXOR(mixed $expectedResult, mixed ...$args): void
|
|
{
|
|
$this->setArrayAsValue();
|
|
$this->runTestCase('XOR', $expectedResult, ...$args);
|
|
}
|
|
|
|
public static function providerXOR(): array
|
|
{
|
|
return require 'tests/data/Calculation/Logical/XOR.php';
|
|
}
|
|
|
|
#[\PHPUnit\Framework\Attributes\DataProvider('providerXORLiteral')]
|
|
public function testXORLiteral(mixed $expectedResult, float|string $formula): void
|
|
{
|
|
$sheet = $this->getSheet();
|
|
$sheet->getCell('A1')->setValue("=XOR($formula)");
|
|
self::assertSame($expectedResult, $sheet->getCell('A1')->getCalculatedValue());
|
|
}
|
|
|
|
public static function providerXORLiteral(): array
|
|
{
|
|
return require 'tests/data/Calculation/Logical/XORLiteral.php';
|
|
}
|
|
}
|