mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-09-07 08:37:05 +00:00
fe79f7b02c
* Fix Unintential Deprecated Calls in Tests - INFORMATION 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. * Missed Some Deprecated Calls Fix them now.
57 lines
1.5 KiB
PHP
57 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Information;
|
|
|
|
use PhpOffice\PhpSpreadsheet\Calculation\Calculation;
|
|
use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError;
|
|
use PhpOffice\PhpSpreadsheet\Calculation\Information\Value;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class IsOddTest extends TestCase
|
|
{
|
|
public function testIsOddNoArgument(): void
|
|
{
|
|
$result = Value::isOdd();
|
|
self::assertSame(ExcelError::NAME(), $result);
|
|
}
|
|
|
|
/**
|
|
* @dataProvider providerIsOdd
|
|
*
|
|
* @param bool|string $expectedResult
|
|
* @param mixed $value
|
|
*/
|
|
public function testIsOdd($expectedResult, $value): void
|
|
{
|
|
$result = Value::isOdd($value);
|
|
self::assertEquals($expectedResult, $result);
|
|
}
|
|
|
|
public function providerIsOdd(): array
|
|
{
|
|
return require 'tests/data/Calculation/Information/IS_ODD.php';
|
|
}
|
|
|
|
/**
|
|
* @dataProvider providerIsOddArray
|
|
*/
|
|
public function testIsOddArray(array $expectedResult, string $values): void
|
|
{
|
|
$calculation = Calculation::getInstance();
|
|
|
|
$formula = "=ISODD({$values})";
|
|
$result = $calculation->_calculateFormulaValue($formula);
|
|
self::assertEquals($expectedResult, $result);
|
|
}
|
|
|
|
public function providerIsOddArray(): array
|
|
{
|
|
return [
|
|
'vector' => [
|
|
[[false, true, false, true, false]],
|
|
'{-2, -1, 0, 1, 2}',
|
|
],
|
|
];
|
|
}
|
|
}
|