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

37 lines
1018 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 SinhTest extends TestCase
{
/**
* @dataProvider providerCosh
*
* @param mixed $expectedResult
* @param mixed $val
*/
public function testSinh($expectedResult, $val = null): void
{
if ($val === null) {
$this->expectException(CalcExp::class);
$formula = '=SINH()';
} else {
$formula = "=SINH($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 providerCosh()
{
return require 'tests/data/Calculation/MathTrig/SINH.php';
}
}