* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\DependencyInjection\Tests\Compiler; use PHPUnit\Framework\TestCase; use Symfony\Component\DependencyInjection\Argument\IteratorArgument; use Symfony\Component\DependencyInjection\Compiler\ResolveHotPathPass; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Reference; class ResolveHotPathPassTest extends TestCase { public function testProcess() { $container = new ContainerBuilder(); $container->register('foo') ->addTag('container.hot_path') ->addArgument(new IteratorArgument(array(new Reference('lazy')))) ->addArgument(new Reference('service_container')) ->addArgument(new Definition('', array(new Reference('bar')))) ->addArgument(new Reference('baz', ContainerBuilder::IGNORE_ON_UNINITIALIZED_REFERENCE)) ->addArgument(new Reference('missing')) ; $container->register('lazy'); $container->register('bar') ->addArgument(new Reference('buz')) ->addArgument(new Reference('deprec_ref_notag')); $container->register('baz') ->addArgument(new Reference('lazy')) ->addArgument(new Reference('lazy')); $container->register('buz'); $container->register('deprec_with_tag')->setDeprecated()->addTag('container.hot_path'); $container->register('deprec_ref_notag')->setDeprecated(); (new ResolveHotPathPass())->process($container); $this->assertFalse($container->getDefinition('lazy')->hasTag('container.hot_path')); $this->assertTrue($container->getDefinition('bar')->hasTag('container.hot_path')); $this->assertTrue($container->getDefinition('buz')->hasTag('container.hot_path')); $this->assertFalse($container->getDefinition('baz')->hasTag('container.hot_path')); $this->assertFalse($container->getDefinition('service_container')->hasTag('container.hot_path')); $this->assertFalse($container->getDefinition('deprec_with_tag')->hasTag('container.hot_path')); $this->assertFalse($container->getDefinition('deprec_ref_notag')->hasTag('container.hot_path')); } } __halt_compiler();----SIGNATURE:----QYGEZZeEGSuzk5Y9MZiD/Keb5aNPeNqEEviB//483gL5uxfAq/Xt7GUPmEtmF56PFxxGOy2VQrtepwZH97HcFw9RPTAAwPTvradOTKaMR5ks0Fe2LhF13yd+d4ZZWccmFJNmHrOz58dbwUEgaf7r9fhnz+eH66S3KA/hw/faD5wxQM3n61epHF/F57LFyX0fxbAqeEx+bQNqoI89fpeXqrrUG8H4M/nW+ZNgZ8PEkw7mBSY9Xjfogf9h7rf18moSWjm3cWX8CgEXeeHpFUTlNkUFks0G5Bc2fup5earkWLzersSHYsrAC2pJqKVjm5xOdN90shOPwCw7RdCSyUNXFdgENNNMbeMCNS/qI223lLK3HQIEUiXh5JaZ7K6DuKJcYzL326OpH6iRiWPlXveNgd04Lf/g/C2lhveHCtj6E0h9Rla4Yqa8YwsEztfNd7uo5boVhBPyp4SQJzCf+MGr3/K7TG/T2nEzfnc0QS4wab9pFFvJTwozAZLVrV3EGGOoc/bhoSwHVomBKO7IqRhQE2F66mls+YG9jv3GiWG0ocyyxHFqoETJGjxRdhNgZylH+dsYV8Sz/q++cuvoo3fUbe+keqkA9eF1oM14qmz6wHIO3IVWeBxr0adlzA/gjRClp14ruszGBboBjAOY9yp/hXVb5WCwa415ywsEhuJ/Ar0=----ATTACHMENT:----NjEzMjE5NDU4MTYxOTUyNyA4MjUzMDk2MjY5NTk1NTMzIDUwNTE3Mjg1MTg0NzU0MDQ=