mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-09-08 17:16:25 +00:00
ac5299b5df
* 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.
40 lines
983 B
PHP
40 lines
983 B
PHP
<?php
|
|
|
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Logical;
|
|
|
|
class OrTest extends AllSetupTeardown
|
|
{
|
|
/**
|
|
* @dataProvider providerOR
|
|
*
|
|
* @param mixed $expectedResult
|
|
*/
|
|
public function testOR($expectedResult, ...$args): void
|
|
{
|
|
$this->runTestCase('OR', $expectedResult, ...$args);
|
|
}
|
|
|
|
public function providerOR(): array
|
|
{
|
|
return require 'tests/data/Calculation/Logical/OR.php';
|
|
}
|
|
|
|
/**
|
|
* @dataProvider providerORLiteral
|
|
*
|
|
* @param mixed $expectedResult
|
|
* @param string $formula
|
|
*/
|
|
public function testORLiteral($expectedResult, $formula): void
|
|
{
|
|
$sheet = $this->getSheet();
|
|
$sheet->getCell('A1')->setValue("=OR($formula)");
|
|
self::assertSame($expectedResult, $sheet->getCell('A1')->getCalculatedValue());
|
|
}
|
|
|
|
public function providerORLiteral(): array
|
|
{
|
|
return require 'tests/data/Calculation/Logical/ORLiteral.php';
|
|
}
|
|
}
|