Sfoglia il codice sorgente

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
Fabien Potencier 12 anni fa
parent
commit
89dce2df51

+ 1 - 1
src/Symfony/Bundle/FrameworkBundle/Console/Application.php

@@ -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.

+ 21 - 3
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->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;
     }
 }