Skip to content

Commit

Permalink
[FrameworkBundle] added test for fix broken command registration
Browse files Browse the repository at this point in the history
  • Loading branch information
Bart van den Burg committed Aug 3, 2012
1 parent fee3f4e commit 79c547f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/Symfony/Bundle/FrameworkBundle/Console/Application.php
Expand Up @@ -17,7 +17,6 @@
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\HttpKernel\Bundle;

/**
* Application.
Expand Down
Expand Up @@ -22,14 +22,32 @@ public function testBundleInterfaceImplementation()
{
$bundle = $this->getMock("Symfony\Component\HttpKernel\Bundle\BundleInterface");

$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(array($bundle)))
->will($this->returnValue($bundles))
;

$application = new Application($kernel);
$application->doRun(new ArrayInput(array('list')), new NullOutput());
return $kernel;
}
}

0 comments on commit 79c547f

Please sign in to comment.