Skip to content

Commit

Permalink
Extract remaining Excel function unit tests into separate test classe…
Browse files Browse the repository at this point in the history
…s for each function (#1817)

* Extract remaining Financial function unit tests into separate test classes for each function

This makes it easier to manage unit tests if they are individual files rather than all in a single file

It also provides a stepping stone toward making it easier to test Excel functions when Excel errors no longer return a string, but an actual Excel exception that can be handled more cleanly
  • Loading branch information
Mark Baker authored Jan 31, 2021
1 parent 41c8a4f commit 5d309e9
Show file tree
Hide file tree
Showing 31 changed files with 910 additions and 502 deletions.
3 changes: 2 additions & 1 deletion src/PhpSpreadsheet/Shared/OLE.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,8 @@ public function getStream($blockIdOrPps)
// in OLE_ChainedBlockStream::stream_open().
// Object is removed from self::$instances in OLE_Stream::close().
$GLOBALS['_OLE_INSTANCES'][] = $this;
$instanceId = end(array_keys($GLOBALS['_OLE_INSTANCES']));
$keys = array_keys($GLOBALS['_OLE_INSTANCES']);
$instanceId = end($keys);

$path = 'ole-chainedblockstream://oleInstanceId=' . $instanceId;
if ($blockIdOrPps instanceof OLE\PPS) {
Expand Down
4 changes: 3 additions & 1 deletion src/PhpSpreadsheet/Worksheet/AutoFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,9 @@ private function calculateTopTenValue($columnID, $startRow, $endRow, $ruleType,
sort($dataValues);
}

return array_pop(array_slice($dataValues, 0, $ruleValue));
$slice = array_slice($dataValues, 0, $ruleValue);

return array_pop($slice);
}

/**
Expand Down
Loading

0 comments on commit 5d309e9

Please sign in to comment.