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] [FrameworkBundle] added test for fix broken command registration --- .../FrameworkBundle/Console/Application.php | 1 - .../Tests/Console/ApplicationTest.php | 24 ++++++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Application.php b/src/Symfony/Bundle/FrameworkBundle/Console/Application.php index ca74d63a0019..6a6735afc318 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\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 089e19157fa0..1427453b1065 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/ApplicationTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/ApplicationTest.php @@ -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; } }