Files
PhpSpreadsheet/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/FormulaTextTest.php
T
oleibman 53e0828d49 Sync composer.lock (#3075)
When I cloned this morning, composer gave me a message that the lock file was not up to date with the latest changes in composer.json. I do not understand why, but it suggested to run `composer update`, which I did. This led to a handful of problems with php-cs-fixer, all fixed with changes to doc-blocks, and phpstan (only Writer/Xls/Worksheet required a change to code). We would presumably have had these problems at the start of next month when dependabot did its thing, so fix them now.
2022-09-20 08:37:00 -07:00

39 lines
996 B
PHP

<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\LookupRef;
use PhpOffice\PhpSpreadsheet\Calculation\LookupRef\Formula;
/**
* Class FormulaTextTest.
*/
class FormulaTextTest extends AllSetupTeardown
{
/**
* @param mixed $value
*
* @dataProvider providerFormulaText
*/
public function testFormulaText(string $expectedResult, $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 function providerFormulaText(): array
{
return require 'tests/data/Calculation/LookupRef/FORMULATEXT.php';
}
public function testNoCell(): void
{
self::assertSame('#REF!', Formula::text('B5'));
}
}