mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-09-04 14:38:16 +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
994 B
PHP
40 lines
994 B
PHP
<?php
|
|
|
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Logical;
|
|
|
|
class AndTest extends AllSetupTeardown
|
|
{
|
|
/**
|
|
* @dataProvider providerAND
|
|
*
|
|
* @param mixed $expectedResult
|
|
*/
|
|
public function testAND($expectedResult, ...$args): void
|
|
{
|
|
$this->runTestCase('AND', $expectedResult, ...$args);
|
|
}
|
|
|
|
public function providerAND(): array
|
|
{
|
|
return require 'tests/data/Calculation/Logical/AND.php';
|
|
}
|
|
|
|
/**
|
|
* @dataProvider providerANDLiteral
|
|
*
|
|
* @param mixed $expectedResult
|
|
* @param string $formula
|
|
*/
|
|
public function testANDLiteral($expectedResult, $formula): void
|
|
{
|
|
$sheet = $this->getSheet();
|
|
$sheet->getCell('A1')->setValue("=AND($formula)");
|
|
self::assertSame($expectedResult, $sheet->getCell('A1')->getCalculatedValue());
|
|
}
|
|
|
|
public function providerANDLiteral(): array
|
|
{
|
|
return require 'tests/data/Calculation/Logical/ANDLiteral.php';
|
|
}
|
|
}
|