Add tests

This commit is contained in:
Robin van der Vliet
2025-11-10 21:50:15 +01:00
parent bfb694a73e
commit e9ec166018
2 changed files with 64 additions and 0 deletions
@@ -0,0 +1,26 @@
<?php
declare(strict_types=1);
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Information;
use PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig\AllSetupTeardown;
class InfoTest extends AllSetupTeardown
{
#[\PHPUnit\Framework\Attributes\DataProvider('providerINFO')]
public function testINFO(mixed $expectedResult, string $typeText): void
{
$this->mightHaveException($expectedResult);
$sheet = $this->getSheet();
$sheet->getCell('A1')->setValue($typeText);
$sheet->getCell('B1')->setValue('=INFO(A1)');
$result = $sheet->getCell('B1')->getCalculatedValue();
self::assertSame($expectedResult, $result);
}
public static function providerINFO(): array
{
return require 'tests/data/Calculation/Information/INFO.php';
}
}
@@ -0,0 +1,38 @@
<?php
declare(strict_types=1);
return [
[
'numfile',
1,
],
[
'osversion',
'PHP ' . phpversion(),
],
[
'recalc',
'Automatic',
],
[
'RECALC',
'AUTOMATIC',
],
[
'system',
'PHP',
],
[
1,
'#VALUE!',
],
[
'A',
'#VALUE!',
],
[
'#VALUE!',
'#VALUE!',
],
];