Skip to content

Commit 084e1e4

Browse files
Reset the peak memory usage returned by memory_get_peak_usage() before the Test\Prepared event is emitted so that (memory usage at Test\Finished - memory usage at Test\Prepared) is the memory usage of the test
1 parent 4409078 commit 084e1e4

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/Event/Emitter/DispatchingEmitter.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
namespace PHPUnit\Event;
1111

1212
use function assert;
13+
use function memory_reset_peak_usage;
1314
use PHPUnit\Event\Code\ClassMethod;
1415
use PHPUnit\Event\Code\ComparisonFailure;
1516
use PHPUnit\Event\Code\IssueTrigger\IssueTrigger;
@@ -499,6 +500,8 @@ public function preConditionFinished(string $testClassName, ClassMethod ...$call
499500
*/
500501
public function testPrepared(Code\Test $test): void
501502
{
503+
memory_reset_peak_usage();
504+
502505
$this->dispatcher->dispatch(
503506
new Test\Prepared(
504507
$this->telemetryInfo(),

0 commit comments

Comments
 (0)