37 lines
1.0 KiB
PHP
37 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
|
|
|
|
use PhpOffice\PhpSpreadsheet\Calculation\Exception as CalcExp;
|
|
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class AsinhTest extends TestCase
|
|
{
|
|
/**
|
|
* @dataProvider providerAsinh
|
|
*
|
|
* @param mixed $expectedResult
|
|
* @param mixed $val
|
|
*/
|
|
public function testAsinh($expectedResult, $val = null): void
|
|
{
|
|
if ($val === null) {
|
|
$this->expectException(CalcExp::class);
|
|
$formula = '=ASINH()';
|
|
} else {
|
|
$formula = "=ASINH($val)";
|
|
}
|
|
$spreadsheet = new Spreadsheet();
|
|
$sheet = $spreadsheet->getActiveSheet();
|
|
$sheet->getCell('A1')->setValue($formula);
|
|
$result = $sheet->getCell('A1')->getCalculatedValue();
|
|
self::assertEqualsWithDelta($expectedResult, $result, 1E-6);
|
|
}
|
|
|
|
public function providerAsinh()
|
|
{
|
|
return require 'tests/data/Calculation/MathTrig/ASINH.php';
|
|
}
|
|
}
|