public function testProcessNoTaggedService()
 {
     $container = $this->prophesize(ContainerBuilder::class);
     $container->has(HandlerCompilerPass::REGISTRY_ID)->willReturn(true);
     $container->findTaggedServiceIds(HandlerCompilerPass::HANDLER_TAG)->willReturn([]);
     $serviceDefinition = $this->prophesize(Definition::class);
     $container->findDefinition(HandlerCompilerPass::REGISTRY_ID)->willReturn($serviceDefinition);
     $compilerPass = new HandlerCompilerPass();
     $compilerPass->process($container->reveal());
     $serviceDefinition->replaceArgument(0, [])->shouldBeCalled();
 }
 public function testProcess()
 {
     $containerBuilder = $this->prophesize(ContainerBuilder::class);
     $definition = $this->prophesize(Definition::class);
     $containerBuilder->has(HandlerCompilerPass::REGISTRY_ID)->willReturn(true);
     $containerBuilder->findDefinition(HandlerCompilerPass::REGISTRY_ID)->willReturn($definition->reveal());
     $containerBuilder->findTaggedServiceIds(HandlerCompilerPass::HANDLER_TAG)->willReturn(['id-1' => [['handler-name' => 'name-1']], 'id-2' => [['handler-name' => 'name-2-1'], ['handler-name' => 'name-2-2']]]);
     $compilerPass = new HandlerCompilerPass();
     $compilerPass->process($containerBuilder->reveal());
     $definition->addMethodCall(HandlerCompilerPass::ADD_FUNCTION_NAME, Argument::that(function ($arguments) {
         return $arguments[0] === 'name-1' && $arguments[1]->__toString() === 'id-1';
     }))->shouldBeCalledTimes(1);
     $definition->addMethodCall(HandlerCompilerPass::ADD_FUNCTION_NAME, Argument::that(function ($arguments) {
         return $arguments[0] === 'name-2-1' && $arguments[1]->__toString() === 'id-2';
     }))->shouldBeCalledTimes(1);
     $definition->addMethodCall(HandlerCompilerPass::ADD_FUNCTION_NAME, Argument::that(function ($arguments) {
         return $arguments[0] === 'name-2-2' && $arguments[1]->__toString() === 'id-2';
     }))->shouldBeCalledTimes(1);
 }