Files
PhpSpreadsheet/tests/PhpSpreadsheetTests/Shared/Trend/ExponentialBestFitTest.php
T
Adrien Crivelli 1b05dfab8b Rector AddParamTypeBasedOnPHPUnitDataProviderRector
And quite a bit more manual changes. The idea is that typing of our
tests can be a bit more loose, so we assume PHPDoc is mostly correct. If
that happens to be wrong, it should be caught by the tests themselves.
2023-09-07 17:00:24 +08:00

43 lines
1.4 KiB
PHP

<?php
namespace PhpOffice\PhpSpreadsheetTests\Shared\Trend;
use PhpOffice\PhpSpreadsheet\Shared\Trend\ExponentialBestFit;
use PHPUnit\Framework\TestCase;
class ExponentialBestFitTest extends TestCase
{
/**
* @dataProvider providerExponentialBestFit
*/
public function testExponentialBestFit(
mixed $expectedSlope,
mixed $expectedIntersect,
mixed $expectedGoodnessOfFit,
mixed $expectedEquation,
mixed $yValues,
mixed $xValues
): void {
$bestFit = new ExponentialBestFit($yValues, $xValues);
$slope = $bestFit->getSlope(1);
self::assertEquals($expectedSlope[0], $slope);
$slope = $bestFit->getSlope();
self::assertEquals($expectedSlope[1], $slope);
$intersect = $bestFit->getIntersect(1);
self::assertEquals($expectedIntersect[0], $intersect);
$intersect = $bestFit->getIntersect();
self::assertEquals($expectedIntersect[1], $intersect);
$equation = $bestFit->getEquation(2);
self::assertEquals($expectedEquation, $equation);
self::assertSame($expectedGoodnessOfFit[0], $bestFit->getGoodnessOfFit(6));
self::assertSame($expectedGoodnessOfFit[1], $bestFit->getGoodnessOfFit());
}
public static function providerExponentialBestFit(): array
{
return require 'tests/data/Shared/Trend/ExponentialBestFit.php';
}
}