mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-09-16 21:16:57 +00:00
Add tests
This commit is contained in:
@@ -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!',
|
||||
],
|
||||
];
|
||||
Reference in New Issue
Block a user