PhpSpreadsheet/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/AsinhTest.php

34 lines
987 B
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
*/
public function testAsinh($expectedResult, string $formula): void
{
if ($expectedResult === 'exception') {
$this->expectException(CalcExp::class);
}
$spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet();
$sheet->getCell('A2')->setValue(0.5);
$sheet->getCell('A1')->setValue("=ASINH($formula)");
$result = $sheet->getCell('A1')->getCalculatedValue();
self::assertEqualsWithDelta($expectedResult, $result, 1E-6);
}
public function providerAsinh()
{
return require 'tests/data/Calculation/MathTrig/ASINH.php';
}
}