mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-09-05 06:58:15 +00:00
Restore Test Disabled Due to Phpunit 10 Bug
Issue3982Test mysteriously ran into memory problems when we migrated from Phpunit 9 to 10. It wasn't all that critical a test, so it has been disabled ever since. I finally had some time to research, and the problem is unquestionably with Phpunit's `assertCount` test - it doesn't like something about our array. However, we can easily redo that test by using Php's native `count` function, and testing that result with `assertSame`. I have not yet succeeded at simplifying the test to a state where I am willing to report the bug, but I'll keep trying. In the meantime, the test is recoded, and can now be run successfully. No source code changes.
This commit is contained in:
@@ -20,16 +20,18 @@ class Issue3982Test extends TestCase
|
||||
* We can mitigate the problem by changing entirely-null rows
|
||||
* to empty rows in rangeToArrayYieldRows. (uses 455MB).
|
||||
* That's a breaking change, but might be worth considering.
|
||||
*
|
||||
* Aha! I have narrowed the problem to self::assertCount,
|
||||
* which has a ready substitution. I will report the problem
|
||||
* to Phpunit if I can come up with a simpler example.
|
||||
*/
|
||||
public function testLoadAllRows(): void
|
||||
{
|
||||
if (!method_exists(TestCase::class, 'setOutputCallback')) {
|
||||
self::markTestSkipped('Memory loop in Phpunit 10');
|
||||
}
|
||||
$spreadsheet = IOFactory::load(self::$testbook);
|
||||
$sheet = $spreadsheet->getActiveSheet();
|
||||
$data = $sheet->toArray(null, true, false, true);
|
||||
self::assertCount(1048576, $data);
|
||||
$count = count($data);
|
||||
self::assertSame(1_048_576, $count);
|
||||
$spreadsheet->disconnectWorksheets();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user