mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-12-03 12:17:48 +08:00
Fixed test cases for pipeline. (#5335)
This commit is contained in:
parent
7ab6583361
commit
e9e0dd14aa
@ -13,11 +13,11 @@ namespace HyperfTest\Di\Aop;
|
||||
|
||||
use Hyperf\Di\Aop\Pipeline;
|
||||
use Hyperf\Di\Aop\ProceedingJoinPoint;
|
||||
use Hyperf\Testing\Debug;
|
||||
use HyperfTest\Di\Stub\Aspect\NoProcessAspect;
|
||||
use Mockery;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use WeakReference;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
@ -30,7 +30,7 @@ class PipelineTest extends TestCase
|
||||
Mockery::close();
|
||||
}
|
||||
|
||||
public function testRefcountForPipelineCarry()
|
||||
public function testWeakReferenceForPipelineCarry()
|
||||
{
|
||||
$container = Mockery::mock(ContainerInterface::class);
|
||||
$container->shouldReceive('get')->with(NoProcessAspect::class)->andReturn(new NoProcessAspect());
|
||||
@ -45,6 +45,9 @@ class PipelineTest extends TestCase
|
||||
});
|
||||
|
||||
$this->assertTrue($res);
|
||||
$this->assertEquals('2', Debug::getRefCount($pipeline));
|
||||
$wr = WeakReference::create($pipeline);
|
||||
$wr->get();
|
||||
unset($pipeline);
|
||||
$this->assertNull($wr->get());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user