Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c9ca322

Browse filesBrowse files
committed
move test to the HttpKernel component
1 parent 8974d77 commit c9ca322
Copy full SHA for c9ca322

File tree

2 files changed

+15
-20
lines changed
Filter options

2 files changed

+15
-20
lines changed

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/AddConsoleCommandPassTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/AddConsoleCommandPassTest.php
-20Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -88,26 +88,6 @@ public function testProcessThrowAnExceptionIfTheServiceIsNotASubclassOfCommand()
8888

8989
$container->compile();
9090
}
91-
92-
public function testHttpKernelRegisterCommandsIngoreCommandAsAService()
93-
{
94-
$container = new ContainerBuilder();
95-
$container->addCompilerPass(new AddConsoleCommandPass());
96-
$definition = new Definition('Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler\MyCommand');
97-
$definition->addTag('console.command');
98-
$container->setDefinition('my-command', $definition);
99-
$container->compile();
100-
101-
$application = $this->getMock('Symfony\Component\Console\Application');
102-
// Never called, because it's the
103-
// Symfony\Bundle\FrameworkBundle\Console\Application that register
104-
// commands as a service
105-
$application->expects($this->never())->method('add');
106-
107-
$bundle = new ExtensionPresentBundle();
108-
$bundle->setContainer($container);
109-
$bundle->registerCommands($application);
110-
}
11191
}
11292

11393
class MyCommand extends Command

‎src/Symfony/Component/HttpKernel/Tests/Bundle/BundleTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/Tests/Bundle/BundleTest.php
+15Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\HttpKernel\Tests\Bundle;
1313

14+
use Symfony\Component\DependencyInjection\ContainerBuilder;
1415
use Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionNotValidBundle\ExtensionNotValidBundle;
1516
use Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionPresentBundle\ExtensionPresentBundle;
1617
use Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionAbsentBundle\ExtensionAbsentBundle;
@@ -41,4 +42,18 @@ public function testGetContainerExtensionWithInvalidClass()
4142
$bundle = new ExtensionNotValidBundle();
4243
$bundle->getContainerExtension();
4344
}
45+
46+
public function testHttpKernelRegisterCommandsIgnoresCommandsThatAreRegisteredAsServices()
47+
{
48+
$container = new ContainerBuilder();
49+
$container->register('console.command.Symfony_Component_HttpKernel_Tests_Fixtures_ExtensionPresentBundle_Command_FooCommand', 'Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionPresentBundle\Command\FooCommand');
50+
51+
$application = $this->getMock('Symfony\Component\Console\Application');
52+
// add() is never called when the found command classes are already registered as services
53+
$application->expects($this->never())->method('add');
54+
55+
$bundle = new ExtensionPresentBundle();
56+
$bundle->setContainer($container);
57+
$bundle->registerCommands($application);
58+
}
4459
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.