Fixed test cases for pipeline. (#5335)

This commit is contained in:
李铭昕 2023-01-20 22:13:09 +08:00 committed by GitHub
parent 7ab6583361
commit e9e0dd14aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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());
}
}