mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-09-11 18:46:49 +00:00
40f7cd00db
We have identical constants defined in several places, and use literals in others. We aren't consistent in checking limits. This PR makes the use of the constants in Cell/AddressRange the "official" source, deprecates all other constants, and substitutes the constants wherever literals are used. A number of different edge case tests are added. During testing, I discovered that `columnIndexFromString` correctly throws an exception for 4-character string, but allows `XFE` through `ZZZ`, all of which are also invalid. There are similar inconsistencies with related routines, and this PR attempts to make them operate consistently. One suprise is that throwing for `row=0` causes serious regression problems, so it continues to be permitted (but the high row limit is enforced). Further, Reference Helper sometimes dips into negative numbers, resulting in totally unexpected results (-1 affects column Z, -2 column Y, etc.). It is changed to ignore rows and columns outside the limits.
29 lines
872 B
PHP
29 lines
872 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace PhpOffice\PhpSpreadsheetTests\Reader\Xls;
|
|
|
|
use PhpOffice\PhpSpreadsheet\Reader\Xls;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class WholeRowAndColumnTest extends TestCase
|
|
{
|
|
/**
|
|
* Test that selection uses PhpSpreadsheet limits, not Xls limits.
|
|
*/
|
|
public function testSelectedRows(): void
|
|
{
|
|
$filename = 'tests/data/Reader/XLS/WholeRowAndColumn.xls';
|
|
$reader = new Xls();
|
|
$spreadsheet = $reader->load($filename);
|
|
$sheet1 = $spreadsheet->getSheetByName('Sheet1');
|
|
self::assertNotNull($sheet1);
|
|
self::assertSame('B1:B1048576', $sheet1->getSelectedCells());
|
|
$sheet2 = $spreadsheet->getSheetByName('Sheet2');
|
|
self::assertNotNull($sheet2);
|
|
self::assertSame('A2:XFD2', $sheet2->getSelectedCells());
|
|
$spreadsheet->disconnectWorksheets();
|
|
}
|
|
}
|