mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-08-26 06:38:34 +00:00
08673b5820
- Refactoring of the Statistical Conditional functions (`AVERAGEIF()`, `AVERAGEIFS()`, `COUNTIF()`, `COUNTIFS()`, `MAXIFS()` and `MINIFS()` to use the new Database functions codebase. - Extended unit testing - Fix handling for null values - Fixes to wildcard text searches There's still scope for further improvements to memory usage and performance; but for now the code is stable with all unit tests passing
32 lines
831 B
PHP
32 lines
831 B
PHP
<?php
|
|
|
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Statistical;
|
|
|
|
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
|
use PhpOffice\PhpSpreadsheet\Calculation\Statistical;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class AverageIfsTest extends TestCase
|
|
{
|
|
protected function setUp(): void
|
|
{
|
|
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
}
|
|
|
|
/**
|
|
* @dataProvider providerAVERAGEIFS
|
|
*
|
|
* @param mixed $expectedResult
|
|
*/
|
|
public function testAVERAGEIFS($expectedResult, ...$args): void
|
|
{
|
|
$result = Statistical\Conditional::AVERAGEIFS(...$args);
|
|
self::assertEqualsWithDelta($expectedResult, $result, 1E-12);
|
|
}
|
|
|
|
public function providerAVERAGEIFS()
|
|
{
|
|
return require 'tests/data/Calculation/Statistical/AVERAGEIFS.php';
|
|
}
|
|
}
|