Skip to content

Commit

Permalink
Merge branch '6.2' into 6.3
Browse files Browse the repository at this point in the history
* 6.2:
  CS fix
  Fix test provider
  • Loading branch information
nicolas-grekas committed Feb 16, 2023
2 parents a0bf343 + 5341195 commit f3f273a
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions Tests/LazyProxy/ContainerBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

use PHPUnit\Framework\TestCase;
use ProxyManager\Proxy\LazyLoadingInterface;
use ProxyManagerBridgeFooClass;
use Symfony\Bridge\ProxyManager\LazyProxy\Instantiator\RuntimeInstantiator;
use Symfony\Component\DependencyInjection\ContainerBuilder;

Expand All @@ -34,8 +33,8 @@ public function testCreateProxyServiceWithRuntimeInstantiator()
$builder = new ContainerBuilder();
$builder->setProxyInstantiator(new RuntimeInstantiator());

$builder->register('foo1', ProxyManagerBridgeFooClass::class)->setFile(__DIR__.'/Fixtures/includes/foo.php')->setPublic(true);
$builder->getDefinition('foo1')->setLazy(true)->addTag('proxy', ['interface' => ProxyManagerBridgeFooClass::class]);
$builder->register('foo1', \ProxyManagerBridgeFooClass::class)->setFile(__DIR__.'/Fixtures/includes/foo.php')->setPublic(true);
$builder->getDefinition('foo1')->setLazy(true)->addTag('proxy', ['interface' => \ProxyManagerBridgeFooClass::class]);

$builder->compile();

Expand All @@ -46,15 +45,15 @@ public function testCreateProxyServiceWithRuntimeInstantiator()
$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(\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->assertInstanceOf(\ProxyManagerBridgeFooClass::class, $foo1->getWrappedValueHolderValue());
$this->assertNotInstanceOf(LazyLoadingInterface::class, $foo1->getWrappedValueHolderValue());

$foo1->__destruct();
Expand Down

0 comments on commit f3f273a

Please sign in to comment.