Files
oleibman ac5299b5df Minor Fix for AND/OR/XOR (#3287)
* Minor Fix for AND/OR/XOR

These 3 fall into the set of functions where Excel treats string literals differently depending on whether they are passed to the function directly or as a cell reference. PhpSpreadsheet is updated to try to duplicate that logic. New tests are added. Some existing test results had to change as a result of this code change.

* Adopt A Suggestion From Mark Baker

Reduce if statements by adding functions.
2023-01-16 05:35:28 -08:00

40 lines
995 B
PHP

<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Logical;
class XorTest extends AllSetupTeardown
{
/**
* @dataProvider providerXOR
*
* @param mixed $expectedResult
*/
public function testXOR($expectedResult, ...$args): void
{
$this->runTestCase('XOR', $expectedResult, ...$args);
}
public function providerXOR(): array
{
return require 'tests/data/Calculation/Logical/XOR.php';
}
/**
* @dataProvider providerXORLiteral
*
* @param mixed $expectedResult
* @param string $formula
*/
public function xtestXORLiteral($expectedResult, $formula): void
{
$sheet = $this->getSheet();
$sheet->getCell('A1')->setValue("=XOR($formula)");
self::assertSame($expectedResult, $sheet->getCell('A1')->getCalculatedValue());
}
public function providerXORLiteral(): array
{
return require 'tests/data/Calculation/Logical/XORLiteral.php';
}
}