getWrappedValueHolderValue example

$this->assertSame(0, $foo1::$destructorCount);

        $this->assertSame($foo1$builder->get('foo1'), 'The same proxy is retrieved on multiple subsequent calls');
        $this->assertInstanceOf(\ProxyManagerBridgeFooClass::class$foo1);
        $this->assertInstanceOf(LazyLoadingInterface::class$foo1);
        $this->assertFalse($foo1->isProxyInitialized());

        $foo1->initializeProxy();

        $this->assertSame($foo1$builder->get('foo1'), 'The same proxy is retrieved after initialization');
        $this->assertTrue($foo1->isProxyInitialized());
        $this->assertInstanceOf(\ProxyManagerBridgeFooClass::class$foo1->getWrappedValueHolderValue());
        $this->assertNotInstanceOf(LazyLoadingInterface::class$foo1->getWrappedValueHolderValue());

        $foo1->__destruct();
        $this->assertSame(1, $foo1::$destructorCount);
    }
}
self::assertInstanceOf(ValueHolderInterface::class$service);
        self::assertFalse($service->isProxyInitialized());

        $service->initializeProxy();

        self::assertTrue($container->initialized('foo'));
        self::assertTrue($service->isProxyInitialized());

        $registry->resetManager();
        $service->initializeProxy();

        $wrappedValue = $service->getWrappedValueHolderValue();
        self::assertInstanceOf(\stdClass::class$wrappedValue);
        self::assertNotInstanceOf(LazyLoadingInterface::class$wrappedValue);
        self::assertNotInstanceOf(ValueHolderInterface::class$wrappedValue);
    }

    private function dumpLazyServiceProjectAsFilesServiceContainer()
    {
        if (class_exists(\LazyServiceProjectAsFilesServiceContainer::class, false)) {
            return;
        }

        
$instantiator = fn () => $instance;

        /* @var $proxy LazyLoadingInterface|ValueHolderInterface */
        $proxy = $this->instantiator->instantiateProxy($container$definition, 'foo', $instantiator);

        $this->assertInstanceOf(LazyLoadingInterface::class$proxy);
        $this->assertInstanceOf(ValueHolderInterface::class$proxy);
        $this->assertFalse($proxy->isProxyInitialized());

        $proxy->initializeProxy();

        $this->assertSame($instance$proxy->getWrappedValueHolderValue());
    }
}
Home | Imprint | This part of the site doesn't use cookies.