mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-09-21 15:49:26 +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
1.2 KiB
PHP
37 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\LookupRef;
|
|
|
|
use PhpOffice\PhpSpreadsheet\Calculation\LookupRef;
|
|
|
|
class RowTest extends AllSetupTeardown
|
|
{
|
|
/**
|
|
* @dataProvider providerROW
|
|
*/
|
|
public function testROW(mixed $expectedResult, null|array|string $cellReference = null): void
|
|
{
|
|
$result = LookupRef\RowColumnInformation::ROW($cellReference);
|
|
self::assertSame($expectedResult, $result);
|
|
}
|
|
|
|
public static function providerROW(): array
|
|
{
|
|
return require 'tests/data/Calculation/LookupRef/ROW.php';
|
|
}
|
|
|
|
public function testROWwithNull(): void
|
|
{
|
|
$sheet = $this->getSheet();
|
|
$sheet->getCell('C4')->setValue('=ROW()');
|
|
self::assertSame(4, $sheet->getCell('C4')->getCalculatedValue());
|
|
$sheet->getCell('D2')->setValue('=ROW(C13)');
|
|
self::assertSame(13, $sheet->getCell('D2')->getCalculatedValue());
|
|
// Sheetnames don't have to exist
|
|
$sheet->getCell('D3')->setValue('=ROW(Sheet17!E15)');
|
|
self::assertSame(15, $sheet->getCell('D3')->getCalculatedValue());
|
|
$sheet->getCell('D4')->setValue("=ROW('Worksheet #5'!X500)");
|
|
self::assertSame(500, $sheet->getCell('D4')->getCalculatedValue());
|
|
}
|
|
}
|