Context::getRootContext() was removed

This commit is contained in:
Guilhem Niot 2022-01-10 16:24:35 +01:00
parent d14471d403
commit 43212d9b7e

View File

@ -58,7 +58,7 @@ class UtilTest extends TestCase
{ {
$context = Util::createContext([], $this->rootContext); $context = Util::createContext([], $this->rootContext);
$this->assertSame($this->rootContext, $context->getRootContext()); $this->assertContextIsConnectedToRootContext($context);
} }
public function testCreateContextWithProperties() public function testCreateContextWithProperties()
@ -818,7 +818,20 @@ class UtilTest extends TestCase
public function assertIsConnectedToRootContext(OA\AbstractAnnotation $annotation) public function assertIsConnectedToRootContext(OA\AbstractAnnotation $annotation)
{ {
$this->assertSame($this->rootContext, $annotation->_context->getRootContext()); $this->assertContextIsConnectedToRootContext($annotation->_context);
}
public function assertContextIsConnectedToRootContext(Context $context)
{
$getRootContext = \Closure::bind(function (Context $context) use (&$getRootContext) {
if (null !== $context->_parent) {
return $getRootContext($context->_parent);
}
return $context;
}, null, Context::class);
$this->assertSame($this->rootContext, $getRootContext($context));
} }
private function getSetupPropertiesWithoutClass(array $setup) private function getSetupPropertiesWithoutClass(array $setup)