From 15abdf43ad978b2ff954b7947e4000041e441b2e Mon Sep 17 00:00:00 2001 From: Michael Roth Date: Mon, 15 Apr 2019 21:39:11 +0200 Subject: [PATCH] - Create unit test (#944) - Add changelog entry for issue #700 --- CHANGELOG.md | 1 + .../Collection/CellsTest.php | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 35d9d5cd..499ae3d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org). - Fix handling for escaped enclosures and new lines in CSV Separator Inference - Fix MATCH an error was appearing when comparing strings against 0 (always true) +- Fix wrong calculation of highest column with specified row [#700](https://github.com/PHPOffice/PhpSpreadsheet/issues/700) - Fix VLOOKUP - Fix return type hint diff --git a/tests/PhpSpreadsheetTests/Collection/CellsTest.php b/tests/PhpSpreadsheetTests/Collection/CellsTest.php index be14aa5d..e1dcfc8f 100644 --- a/tests/PhpSpreadsheetTests/Collection/CellsTest.php +++ b/tests/PhpSpreadsheetTests/Collection/CellsTest.php @@ -114,4 +114,21 @@ class CellsTest extends TestCase $collection->add('A1', $cell); $collection->add('A2', $cell); } + + public function testGetHighestColumn() + { + $workbook = new Spreadsheet(); + $sheet = $workbook->getActiveSheet(); + $collection = $sheet->getCellCollection(); + + // check for empty sheet + $this->assertEquals('A', $collection->getHighestColumn()); + $this->assertEquals('A', $collection->getHighestColumn(1)); + + // set a value and check again + $sheet->getCell('C4')->setValue(1); + $this->assertEquals('C', $collection->getHighestColumn()); + $this->assertEquals('A', $collection->getHighestColumn(1)); + $this->assertEquals('C', $collection->getHighestColumn(4)); + } }