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

[FrameworkBundle][HttpKernel] move test to the HttpKernel component #20273

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 22, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -88,26 +88,6 @@ public function testProcessThrowAnExceptionIfTheServiceIsNotASubclassOfCommand()

$container->compile();
}

public function testHttpKernelRegisterCommandsIngoreCommandAsAService()
{
$container = new ContainerBuilder();
$container->addCompilerPass(new AddConsoleCommandPass());
$definition = new Definition('Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler\MyCommand');
$definition->addTag('console.command');
$container->setDefinition('my-command', $definition);
$container->compile();

$application = $this->getMock('Symfony\Component\Console\Application');
// Never called, because it's the
// Symfony\Bundle\FrameworkBundle\Console\Application that register
// commands as a service
$application->expects($this->never())->method('add');

$bundle = new ExtensionPresentBundle();
$bundle->setContainer($container);
$bundle->registerCommands($application);
}
}

class MyCommand extends Command
Expand Down
15 changes: 15 additions & 0 deletions 15 src/Symfony/Component/HttpKernel/Tests/Bundle/BundleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace Symfony\Component\HttpKernel\Tests\Bundle;

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionNotValidBundle\ExtensionNotValidBundle;
use Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionPresentBundle\ExtensionPresentBundle;
use Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionAbsentBundle\ExtensionAbsentBundle;
Expand Down Expand Up @@ -41,4 +42,18 @@ public function testGetContainerExtensionWithInvalidClass()
$bundle = new ExtensionNotValidBundle();
$bundle->getContainerExtension();
}

public function testHttpKernelRegisterCommandsIgnoresCommandsThatAreRegisteredAsServices()
{
$container = new ContainerBuilder();
$container->register('console.command.Symfony_Component_HttpKernel_Tests_Fixtures_ExtensionPresentBundle_Command_FooCommand', 'Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionPresentBundle\Command\FooCommand');

$application = $this->getMock('Symfony\Component\Console\Application');
// add() is never called when the found command classes are already registered as services
$application->expects($this->never())->method('add');

$bundle = new ExtensionPresentBundle();
$bundle->setContainer($container);
$bundle->registerCommands($application);
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.