Skip to content

Commit

Permalink
Improved MemoryLeakTest
Browse files Browse the repository at this point in the history
  • Loading branch information
vudaltsov committed Feb 9, 2024
1 parent 39e3411 commit cf61cba
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/memory/MemoryLeakTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ private static function assertMemoryIsConstant(\Closure $action): void

public function testTyphoonReflectorClassExistsIsNotLeaking(): void
{
// warm up
TyphoonReflector::build(phpParser: self::$phpParser)->classExists(Type\NamedObjectType::class);
self::cleanUpParser();

foreach (self::CLASSES as $class) {
self::assertMemoryIsConstant(static function () use ($class): void {
TyphoonReflector::build(phpParser: self::$phpParser)->classExists($class);
Expand All @@ -86,6 +90,7 @@ public function testTyphoonReflectorReflectIsNotLeaking(): void

public function testReflectionSessionClassExistsIsNotLeaking(): void
{
// warm up
$session = TyphoonReflector::build(phpParser: self::$phpParser)->startSession();
$session->classExists(Type\NamedObjectType::class);
$session->flush();
Expand All @@ -101,6 +106,7 @@ public function testReflectionSessionClassExistsIsNotLeaking(): void

public function testReflectionSessionReflectIsNotLeaking(): void
{
// warm up
$session = TyphoonReflector::build(phpParser: self::$phpParser)->startSession();
$session->reflectClass(Type\NamedObjectType::class);
$session->flush();
Expand Down

0 comments on commit cf61cba

Please sign in to comment.