[FrameworkBundle] added test for fix broken command registration

This commit is contained in:
Bart van den Burg 2012-08-03 13:21:57 +02:00
parent fee3f4e1ef
commit 79c547f09c
2 changed files with 24 additions and 7 deletions

View File

@ -17,7 +17,6 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\HttpKernel\Bundle;
/**
* Application.

View File

@ -22,14 +22,32 @@ class ApplicationTest extends TestCase
{
$bundle = $this->getMock("Symfony\Component\HttpKernel\Bundle\BundleInterface");
$kernel = $this->getMock("Symfony\Component\HttpKernel\KernelInterface");
$kernel
->expects($this->any())
->method('getBundles')
->will($this->returnValue(array($bundle)))
;
$kernel = $this->getKernel(array($bundle));
$application = new Application($kernel);
$application->doRun(new ArrayInput(array('list')), new NullOutput());
}
public function testBundleCommandsAreRegistered()
{
$bundle = $this->getMock("Symfony\Component\HttpKernel\Bundle\Bundle");
$bundle->expects($this->once())->method('registerCommands');
$kernel = $this->getKernel(array($bundle));
$application = new Application($kernel);
$application->doRun(new ArrayInput(array('list')), new NullOutput());
}
private function getKernel(array $bundles)
{
$kernel = $this->getMock("Symfony\Component\HttpKernel\KernelInterface");
$kernel
->expects($this->any())
->method('getBundles')
->will($this->returnValue($bundles))
;
return $kernel;
}
}