8000 [FrameworkBundle] added test for fix broken command registration · sun/symfony@79c547f · GitHub
[go: up one dir, main page]

Skip to content

Commit 79c547f

Browse files
author
Bart van den Burg
committed
[FrameworkBundle] added test for fix broken command registration
1 parent fee3f4e commit 79c547f

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

src/Symfony/Bundle/FrameworkBundle/Console/Application.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use Symfony\Component\Console\Output\OutputInterface;
1818
use Symfony\Component\HttpKernel\KernelInterface;
1919
use Symfony\Component\HttpKernel\Kernel;
20-
use Symfony\Component\HttpKernel\Bundle;
2120

2221
/**
2322
* Application.

src/Symfony/Bundle/FrameworkBundle/Tests/Console/ApplicationTest.php

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,32 @@ public function testBundleInterfaceImplementation()
2222
{
2323
$bundle = $this->getMock("Symfony\Component\HttpKernel\Bundle\BundleInterface");
2424

25+
$kernel = $this->getKernel(array($bundle));
26+
27+
$application = new Application($kernel);
28+
$application->doRun(new ArrayInput(array('list')), new NullOutput());
29+
}
30+
31+
public function testBundleCommandsAreRegistered()
32+
{
33+
$bundle = $this->getMock("Symfony\Component\HttpKernel\Bundle\Bundle");
34+
$bundle->expects($this->once())->method('registerCommands');
35+
36+
$kernel = $this->getKernel(array($bundle));
37+
38+
$application = new Application($kernel);
39+
$application->doRun(new ArrayInput(array('list')), new NullOutput());
40+
}
41+
42+
private function getKernel(array $bundles)
43+
{
2544
$kernel = $this->getMock("Symfony\Component\HttpKernel\KernelInterface");
2645
$kernel
2746
->expects($this->any())
2847
->method('getBundles')
29-
->will($this->returnValue(array($bundle)))
48+
->will($this->returnValue($bundles))
3049
;
3150

32-
$application = new Application($kernel);
33-
$application->doRun(new ArrayInput(array('list')), new NullOutput());
51+
return $kernel;
3452
}
3553
}

0 commit comments

Comments
 (0)
0