File tree 1 file changed +6
-3
lines changed
1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 13
13
14
14
use Hyperf \Di \Aop \Pipeline ;
15
15
use Hyperf \Di \Aop \ProceedingJoinPoint ;
16
- use Hyperf \Testing \Debug ;
17
16
use HyperfTest \Di \Stub \Aspect \NoProcessAspect ;
18
17
use Mockery ;
19
18
use PHPUnit \Framework \TestCase ;
20
19
use Psr \Container \ContainerInterface ;
20
+ use WeakReference ;
21
21
22
22
/**
23
23
* @internal
@@ -30,7 +30,7 @@ protected function tearDown(): void
30
30
Mockery::close ();
31
31
}
32
32
33
- public function testRefcountForPipelineCarry ()
33
+ public function testWeakReferenceForPipelineCarry ()
34
34
{
35
35
$ container = Mockery::mock (ContainerInterface::class);
36
36
$ container ->shouldReceive ('get ' )->with (NoProcessAspect::class)->andReturn (new NoProcessAspect ());
@@ -45,6 +45,9 @@ public function testRefcountForPipelineCarry()
45
45
});
46
46
47
47
$ 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 ());
49
52
}
50
53
}
You can’t perform that action at this time.
0 commit comments