private function getKernel(array $bundles, $useDispatcher = false)
{
$container = $this->getMockBuilder('Symfony\\Component\\DependencyInjection\\ContainerInterface')->getMock();
if ($useDispatcher) {
$dispatcher = $this->getMockBuilder('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface')->getMock();
$dispatcher->expects($this->atLeastOnce())->method('dispatch');
$container->expects($this->atLeastOnce())->method('get')->with($this->equalTo('event_dispatcher'))->will($this->returnValue($dispatcher));
}
$container->expects($this->once())->method('hasParameter')->with($this->equalTo('console.command.ids'))->will($this->returnValue(true));
$container->expects($this->once())->method('getParameter')->with($this->equalTo('console.command.ids'))->will($this->returnValue(array()));
$kernel = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\KernelInterface')->getMock();
$kernel->expects($this->any())->method('getBundles')->will($this->returnValue($bundles));
$kernel->expects($this->any())->method('getContainer')->will($this->returnValue($container));
return $kernel;
}