mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-09-04 06:33:33 +00:00
3697352e28
* Fix Unintential Deprecated Calls in Tests - LOGICAL I think it's best to install these before PR #3166. There are no changes to source code, only to doc-blocks and to test members which continue to inadvertently use calls to deprecated functions. * Change Unit Tests to Run in Spreadsheet Context They had been run as direct calls, which is not how most users would use them. Making this change exposed some minor coding errors - SWITCH needs to flatten its arguments, and IFERROR and IFNA were not handling a null testValue in the same manner as Excel.
46 lines
1.1 KiB
PHP
46 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Logical;
|
|
|
|
use PhpOffice\PhpSpreadsheet\Calculation\Calculation;
|
|
|
|
class NotTest extends AllSetupTeardown
|
|
{
|
|
/**
|
|
* @dataProvider providerNOT
|
|
*
|
|
* @param mixed $expectedResult
|
|
*/
|
|
public function testNOT($expectedResult, ...$args): void
|
|
{
|
|
$this->runTestCase('NOT', $expectedResult, ...$args);
|
|
}
|
|
|
|
public function providerNOT(): array
|
|
{
|
|
return require 'tests/data/Calculation/Logical/NOT.php';
|
|
}
|
|
|
|
/**
|
|
* @dataProvider providerNotArray
|
|
*/
|
|
public function testNotArray(array $expectedResult, string $argument1): void
|
|
{
|
|
$calculation = Calculation::getInstance();
|
|
|
|
$formula = "=NOT({$argument1})";
|
|
$result = $calculation->_calculateFormulaValue($formula);
|
|
self::assertEquals($expectedResult, $result);
|
|
}
|
|
|
|
public function providerNotArray(): array
|
|
{
|
|
return [
|
|
'vector' => [
|
|
[[false, true, true, false]],
|
|
'{TRUE, FALSE, FALSE, TRUE}',
|
|
],
|
|
];
|
|
}
|
|
}
|