private function createBundleMock(array $commands)
{
$bundle = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\Bundle\\Bundle')->getMock();
$bundle->expects($this->once())->method('registerCommands')->will($this->returnCallback(function (Application $application) use($commands) {
$application->addCommands($commands);
}));
return $bundle;
}