Example #1
0
 public function testHttpKernelRegisterCommandsIgnoresCommandsThatAreRegisteredAsServices()
 {
     $container = new ContainerBuilder();
     $container->register('console.command.Symfony_Component_HttpKernel_Tests_Fixtures_ExtensionPresentBundle_Command_FooCommand', 'Symfony\\Component\\HttpKernel\\Tests\\Fixtures\\ExtensionPresentBundle\\Command\\FooCommand');
     $application = $this->getMock('Symfony\\Component\\Console\\Application');
     // add() is never called when the found command classes are already registered as services
     $application->expects($this->never())->method('add');
     $bundle = new ExtensionPresentBundle();
     $bundle->setContainer($container);
     $bundle->registerCommands($application);
 }
Example #2
0
 public function testRegisterCommandsIngoreCommandAsAService()
 {
     $container = new ContainerBuilder();
     $container->addCompilerPass(new AddConsoleCommandPass());
     $definition = new Definition('Symfony\\Component\\HttpKernel\\Tests\\Fixtures\\ExtensionPresentBundle\\Command\\FooCommand');
     $definition->addTag('console.command');
     $container->setDefinition('my-command', $definition);
     $container->compile();
     $application = $this->getMock('Symfony\\Component\\Console\\Application');
     // Never called, because it's the
     // Symfony\Bundle\FrameworkBundle\Console\Application that register
     // commands as a service
     $application->expects($this->never())->method('add');
     $bundle = new ExtensionPresentBundle();
     $bundle->setContainer($container);
     $bundle->registerCommands($application);
 }