From 79c547f09c1f6d1eeb509c89e1109b692ababc0a Mon Sep 17 00:00:00 2001 From: Bart van den Burg Date: Fri, 3 Aug 2012 13:21:57 +0200 Subject: [PATCH 1/2] [FrameworkBundle] added test for fix broken command registration --- .../FrameworkBundle/Console/Application.php | 1 - .../Tests/Console/ApplicationTest.php | 30 +++++++++++++++---- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Application.php b/src/Symfony/Bundle/FrameworkBundle/Console/Application.php index ca74d63a00..6a6735afc3 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Application.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Application.php @@ -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. diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/ApplicationTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/ApplicationTest.php index 089e19157f..1427453b10 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/ApplicationTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/ApplicationTest.php @@ -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; + } } From 55a0b347a0a3fea8b3a0e6d5829ef75aa115cffe Mon Sep 17 00:00:00 2001 From: smokeybear87 Date: Fri, 3 Aug 2012 11:50:44 +0200 Subject: [PATCH 2/2] Fixes incorrect class used in src/Symfony/Bundle/FrameworkBundle/Console/Application.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue must be related to commit 7a5f6142405c599cf0eb54e80c98e54e41ab4fdf (merged 2.0), specifically this file src/Symfony/Bundle/FrameworkBundle/Console/Application.php, lines 86-88.  Presumably to do "instanceof Bundle" correct class has to be imported at the top of the file: instead of  use Symfony\Component\HttpKernel\Bundle; this should be use Symfony\Component\HttpKernel\Bundle\Bundle; Conflicts: src/Symfony/Bundle/FrameworkBundle/Console/Application.php --- src/Symfony/Bundle/FrameworkBundle/Console/Application.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Application.php b/src/Symfony/Bundle/FrameworkBundle/Console/Application.php index 6a6735afc3..c7ed22cf7c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Application.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Application.php @@ -17,6 +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\Bundle; /** * Application.