[HttpKernel] "controller.service_arguments" services should be public

This commit is contained in:
Nicolas Grekas 2017-09-07 14:05:56 +02:00
parent 5f5ed69bea
commit b9c6928d7e
2 changed files with 16 additions and 0 deletions

View File

@ -50,6 +50,7 @@ class RegisterControllerArgumentLocatorsPass implements CompilerPassInterface
foreach ($container->findTaggedServiceIds($this->controllerTag, true) as $id => $tags) {
$def = $container->getDefinition($id);
$def->setPublic(true);
$class = $def->getClass();
$autowire = $def->isAutowired();

View File

@ -266,6 +266,21 @@ class RegisterControllerArgumentLocatorsPassTest extends TestCase
$locator = $container->getDefinition((string) $resolver->getArgument(0))->getArgument(0);
$this->assertEmpty(array_keys($locator));
}
public function testControllersAreMadePublic()
{
$container = new ContainerBuilder();
$resolver = $container->register('argument_resolver.service')->addArgument(array());
$container->register('foo', ArgumentWithoutTypeController::class)
->setPublic(false)
->addTag('controller.service_arguments');
$pass = new RegisterControllerArgumentLocatorsPass();
$pass->process($container);
$this->assertTrue($container->getDefinition('foo')->isPublic());
}
}
class RegisterTestController