public function testBinding() { $container =
new ContainerBuilder();
$container->
register('foo', TestServiceSubscriber::
class) ->
addMethodCall('setServiceProvider'
) ->
addTag('container.service_subscriber'
) ;
(new RegisterServiceSubscribersPass())->
process($container);
(new ResolveBindingsPass())->
process($container);
$foo =
$container->
getDefinition('foo'
);
$locator =
$container->
getDefinition((string) $foo->
getMethodCalls()[0
][1
][0
]);
$this->
assertFalse($locator->
isPublic());
$this->
assertSame(ServiceLocator::
class,
$locator->
getClass());
$expected =
[ TestServiceSubscriber::
class => new ServiceClosureArgument(new TypedReference(TestServiceSubscriber::
class, TestServiceSubscriber::
class)),
CustomDefinition::
class => new ServiceClosureArgument(new TypedReference(CustomDefinition::
class, CustomDefinition::
class, ContainerInterface::IGNORE_ON_INVALID_REFERENCE
)),
'bar' =>
new ServiceClosureArgument(new TypedReference(CustomDefinition::
class, CustomDefinition::
class, ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, 'bar'
)),