File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 1313
1414use Hyperf \Di \Aop \Pipeline ;
1515use Hyperf \Di \Aop \ProceedingJoinPoint ;
16- use Hyperf \Testing \Debug ;
1716use HyperfTest \Di \Stub \Aspect \NoProcessAspect ;
1817use Mockery ;
1918use PHPUnit \Framework \TestCase ;
2019use Psr \Container \ContainerInterface ;
20+ use WeakReference ;
2121
2222/**
2323 * @internal
@@ -30,7 +30,7 @@ protected function tearDown(): void
3030 Mockery::close ();
3131 }
3232
33- public function testRefcountForPipelineCarry ()
33+ public function testWeakReferenceForPipelineCarry ()
3434 {
3535 $ container = Mockery::mock (ContainerInterface::class);
3636 $ container ->shouldReceive ('get ' )->with (NoProcessAspect::class)->andReturn (new NoProcessAspect ());
@@ -45,6 +45,9 @@ public function testRefcountForPipelineCarry()
4545 });
4646
4747 $ this ->assertTrue ($ res );
48- $ this ->assertEquals ('2 ' , Debug::getRefCount ($ pipeline ));
48+ $ wr = WeakReference::create ($ pipeline );
49+ $ wr ->get ();
50+ unset($ pipeline );
51+ $ this ->assertNull ($ wr ->get ());
4952 }
5053}
You can’t perform that action at this time.
0 commit comments