|
| 1 | +<?php |
| 2 | + |
| 3 | +/* |
| 4 | + * This file is part of the Symfony package. |
| 5 | + * |
| 6 | + * (c) Fabien Potencier <fabien@symfony.com> |
| 7 | + * |
| 8 | + * For the full copyright and license information, please view the LICENSE |
| 9 | + * file that was distributed with this source code. |
| 10 | + */ |
| 11 | + |
| 12 | +namespace Symfony\Component\DependencyInjection\Tests\Compiler; |
| 13 | + |
| 14 | +use Symfony\Component\DependencyInjection\Compiler\ResolveParameterPlaceHoldersPass; |
| 15 | +use Symfony\Component\DependencyInjection\ContainerBuilder; |
| 16 | + |
| 17 | +/** |
| 18 | + * @group legacy |
| 19 | + */ |
| 20 | +class LegacyResolveParameterPlaceHoldersPassTest extends \PHPUnit_Framework_TestCase |
| 21 | +{ |
| 22 | + private $compilerPass; |
| 23 | + private $container; |
| 24 | + private $fooDefinition; |
| 25 | + |
| 26 | + protected function setUp() |
| 27 | + { |
| 28 | + $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); |
| 29 | + |
| 30 | + $this->compilerPass = new ResolveParameterPlaceHoldersPass(); |
| 31 | + $this->container = $this->createContainerBuilder(); |
| 32 | + $this->compilerPass->process($this->container); |
| 33 | + $this->fooDefinition = $this->container->getDefinition('foo'); |
| 34 | + } |
| 35 | + |
| 36 | + private function createContainerBuilder() |
| 37 | + { |
| 38 | + $containerBuilder = new ContainerBuilder(); |
| 39 | + $containerBuilder->setParameter('foo.class', 'Foo'); |
| 40 | + $containerBuilder->setParameter('foo.factory.class', 'FooFactory'); |
| 41 | + $fooDefinition = $containerBuilder->register('foo', '%foo.class%'); |
| 42 | + $fooDefinition->setFactoryClass('%foo.factory.class%'); |
| 43 | + |
| 44 | + return $containerBuilder; |
| 45 | + } |
| 46 | + |
| 47 | + public function testFactoryClassParametersShouldBeResolved() |
| 48 | + { |
| 49 | + $this->assertSame('FooFactory', $this->fooDefinition->getFactoryClass()); |
| 50 | + } |
| 51 | +} |
0 commit comments