merged branch SamsonIT/fix_broken_command_registration (PR #5169)

Commits
-------

55a0b34 Fixes incorrect class used in src/Symfony/Bundle/FrameworkBundle/Console/Application.php
79c547f [FrameworkBundle] added test for fix broken command registration

Discussion
----------

[FrameworkBundle] fix broken command registration

fixed #5168, #5166

---------------------------------------------------------------------------

by travisbot at 2012-08-03T11:35:29Z

This pull request [passes](http://travis-ci.org/symfony/symfony/builds/2027699) (merged 39e964b8 into fee3f4e1).

---------------------------------------------------------------------------

by travisbot at 2012-08-03T11:45:14Z

This pull request [passes](http://travis-ci.org/symfony/symfony/builds/2027761) (merged 55a0b347 into fee3f4e1).

---------------------------------------------------------------------------

by xeross at 2012-08-03T11:45:45Z

Duplicate of #5166

---------------------------------------------------------------------------

by Burgov at 2012-08-03T11:47:54Z

@xeross that PR was opened on master instead of 2.0

---------------------------------------------------------------------------

by xeross at 2012-08-03T11:48:49Z

@Burgov Ah sorry, I got confused and thought this was another dupe
This commit is contained in:
Fabien Potencier 2012-08-03 14:43:49 +02:00
commit 89dce2df51
2 changed files with 25 additions and 7 deletions

View File

@ -17,7 +17,7 @@ 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;
use Symfony\Component\HttpKernel\Bundle\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;
}
}