* * 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:----qlZqS6iagDOF2Qh/slXGJ/X3Z7Z/ONMpx0/a3wraBZXZIE1MFEihWeQrmRDKOwf8MPPJwaa5J33GoAlD35hEE+TiqXcuItiz+ye+uYSL8tnKIkZdHNdWbLyNHVDiPS7Nv/5ZXnGHqJSUnoh1RIMcaq2q5sBErzQqnXNZs1BA1T9w/rN1SMYZSop1pT8WkzgCbql2vDNgwofs2W1I63Z8eXuQr94erxjGMWjshWwbTECwKRTkf3HLGxClqSyY9HQ5oxHglVZgyvPe7vfrTjHIPrn6UuyqKuYQtc0rjlaLuQ7lCWkE/xRb0vB/+sbAhZ7SQG7MzwzlQHIFLdJEhAF28utDMkn418TwwgtfY4nreIASymZnD9GvZxnxGUPbabGY/AeSwavZgSlTuPriWAyoc6wjMYsBe90cTrOLzu1+I0H9VcsV0z13hsS77X7KqOSFCHmDN80RX0PYfkoXyt6TWW3J/r9H/GqQRSqtg93M0Uf7NxI/fiWeDDSnrHY3YMRrYLa+90r2TEQ3s92VANKiIIi0rqWxKQdHR7yKJbwhYNnWdbc5+Xe9riXU8wrvRMzB11sRUbVdrl/dQj5A/2PLYU1BsnGv2LC9sOaJeq+0SShq6g7fHiFNGllbOOXTI0RwR8r62nP8Nre/9osQIPLCatpj0yg0Zmi+XqWb1eJouKM=----ATTACHMENT:----NjM3MzY3MzI0ODkxNjgxMCA1NDAyMjY0MjEzNDcxMjE4IDc2NjY1ODcxMjY4NTU4MDU=