/**
  * Verifies that the generated container retrieves the same proxy instance on multiple subsequent requests.
  */
 public function testDumpContainerWithProxyServiceWillShareProxies()
 {
     require_once __DIR__ . '/../Fixtures/php/lazy_service.php';
     $container = new \LazyServiceProjectServiceContainer();
     /* @var $proxy \stdClass_c1d194250ee2e2b7d2eab8b8212368a8 */
     $proxy = $container->get('foo');
     $this->assertInstanceOf('stdClass_c1d194250ee2e2b7d2eab8b8212368a8', $proxy);
     $this->assertSame($proxy, $container->get('foo'));
     $this->assertFalse($proxy->isProxyInitialized());
     $proxy->initializeProxy();
     $this->assertTrue($proxy->isProxyInitialized());
     $this->assertSame($proxy, $container->get('foo'));
 }
Example #2
0
 /**
  * Verifies that the generated container retrieves the same proxy instance on multiple subsequent requests.
  */
 public function testDumpContainerWithProxyServiceWillShareProxies()
 {
     if (class_exists(StaticProxyConstructor::class)) {
         // detecting ProxyManager v2
         require_once __DIR__ . '/../Fixtures/php/lazy_service_with_hints.php';
     } else {
         require_once __DIR__ . '/../Fixtures/php/lazy_service.php';
     }
     $container = new \LazyServiceProjectServiceContainer();
     /* @var $proxy \stdClass_c1d194250ee2e2b7d2eab8b8212368a8 */
     $proxy = $container->get('foo');
     $this->assertInstanceOf('stdClass_c1d194250ee2e2b7d2eab8b8212368a8', $proxy);
     $this->assertSame($proxy, $container->get('foo'));
     $this->assertFalse($proxy->isProxyInitialized());
     $proxy->initializeProxy();
     $this->assertTrue($proxy->isProxyInitialized());
     $this->assertSame($proxy, $container->get('foo'));
 }