Skip to content

Commit ead7678

Browse files
authored
Fixed test cases for pipeline. (#5335)
1 parent 1cb7161 commit ead7678

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tests/Aop/PipelineTest.php

+6-3
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313

1414
use Hyperf\Di\Aop\Pipeline;
1515
use Hyperf\Di\Aop\ProceedingJoinPoint;
16-
use Hyperf\Testing\Debug;
1716
use HyperfTest\Di\Stub\Aspect\NoProcessAspect;
1817
use Mockery;
1918
use PHPUnit\Framework\TestCase;
2019
use 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
}

0 commit comments

Comments
 (0)