diff --git a/tests/PhpSpreadsheetTests/Reader/Xlsx/XlsxTest.php b/tests/PhpSpreadsheetTests/Reader/Xlsx/XlsxTest.php index ab5081ccc6..bf51fdb8b4 100644 --- a/tests/PhpSpreadsheetTests/Reader/Xlsx/XlsxTest.php +++ b/tests/PhpSpreadsheetTests/Reader/Xlsx/XlsxTest.php @@ -6,6 +6,7 @@ use PhpOffice\PhpSpreadsheet\Cell\Coordinate; use PhpOffice\PhpSpreadsheet\IOFactory; +use PhpOffice\PhpSpreadsheet\Reader\IReader; use PhpOffice\PhpSpreadsheet\Reader\Xlsx; use PhpOffice\PhpSpreadsheet\Shared\File; use PhpOffice\PhpSpreadsheet\Style\Conditional; @@ -245,4 +246,22 @@ public static function providerStripsWhiteSpaceFromStyleString(): array height:13.5pt;z-index:5;mso-wrap-style:tight'], ]; } + + public function testLoadDataOnlyLoadsAlsoTables(): void + { + $filename = 'tests/data/Reader/XLSX/data_with_tables.xlsx'; + $reader = new Xlsx(); + $excel = $reader->load($filename, IReader::READ_DATA_ONLY); + + self::assertEquals(['First', 'Second'], $excel->getSheetNames()); + self::assertEquals('A1:B5', $excel->getTableByName('Tableau1')->getRange()); + self::assertEquals([['1', '2', '3']], $excel->getSheetByName('First')->toArray()); + self::assertEquals([ + ['Colonne1', 'Colonne2'], + ['a', 'b',], + ['c', 'd'], + ['e', 'f'], + ['g', 'h'], + ], $excel->getSheetByName('Second')->toArray()); + } } diff --git a/tests/data/Reader/XLSX/data_with_tables.xlsx b/tests/data/Reader/XLSX/data_with_tables.xlsx new file mode 100644 index 0000000000..30e4f8a3b1 Binary files /dev/null and b/tests/data/Reader/XLSX/data_with_tables.xlsx differ