LegacyResolveParameterPlaceHoldersPassTest.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\DependencyInjection\Tests\Compiler;
  11. use PHPUnit\Framework\TestCase;
  12. use Symfony\Component\DependencyInjection\Compiler\ResolveParameterPlaceHoldersPass;
  13. use Symfony\Component\DependencyInjection\ContainerBuilder;
  14. /**
  15. * @group legacy
  16. */
  17. class LegacyResolveParameterPlaceHoldersPassTest extends TestCase
  18. {
  19. public function testFactoryClassParametersShouldBeResolved()
  20. {
  21. $compilerPass = new ResolveParameterPlaceHoldersPass();
  22. $container = new ContainerBuilder();
  23. $container->setParameter('foo.factory.class', 'FooFactory');
  24. $fooDefinition = $container->register('foo', '%foo.factory.class%');
  25. $fooDefinition->setFactoryClass('%foo.factory.class%');
  26. $compilerPass->process($container);
  27. $fooDefinition = $container->getDefinition('foo');
  28. $this->assertSame('FooFactory', $fooDefinition->getFactoryClass());
  29. }
  30. }