mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-09-23 00:30:09 +00:00
1b05dfab8b
And quite a bit more manual changes. The idea is that typing of our tests can be a bit more loose, so we assume PHPDoc is mostly correct. If that happens to be wrong, it should be caught by the tests themselves.
37 lines
975 B
PHP
37 lines
975 B
PHP
<?php
|
|
|
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\LookupRef;
|
|
|
|
use PhpOffice\PhpSpreadsheet\Calculation\LookupRef\Formula;
|
|
|
|
/**
|
|
* Class FormulaTextTest.
|
|
*/
|
|
class FormulaTextTest extends AllSetupTeardown
|
|
{
|
|
/**
|
|
* @dataProvider providerFormulaText
|
|
*/
|
|
public function testFormulaText(string $expectedResult, mixed $value): void
|
|
{
|
|
$sheet = $this->getSheet();
|
|
$reference = 'A1';
|
|
if ($value !== null) {
|
|
$sheet->getCell($reference)->setValue($value);
|
|
}
|
|
$sheet->getCell('D1')->setValue("=FORMULATEXT($reference)");
|
|
$result = $sheet->getCell('D1')->getCalculatedValue();
|
|
self::assertSame($expectedResult, $result);
|
|
}
|
|
|
|
public static function providerFormulaText(): array
|
|
{
|
|
return require 'tests/data/Calculation/LookupRef/FORMULATEXT.php';
|
|
}
|
|
|
|
public function testNoCell(): void
|
|
{
|
|
self::assertSame('#REF!', Formula::text('B5'));
|
|
}
|
|
}
|