fixed some composer.json to make standalone component tests pass

This commit is contained in:
Fabien Potencier 2014-09-27 22:16:29 +02:00
parent de780e88fd
commit 5c3cea59ba
6 changed files with 29 additions and 23 deletions

View File

@ -15,6 +15,7 @@ use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddConsoleComman
use Symfony\Component\Console\Command\Command;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class AddConsoleCommandPassTest extends \PHPUnit_Framework_TestCase
{
@ -87,8 +88,32 @@ class AddConsoleCommandPassTest extends \PHPUnit_Framework_TestCase
$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
{
}
class ExtensionPresentBundle extends Bundle
{
}

View File

@ -23,7 +23,7 @@
"symfony/property-access": "~2.3"
},
"require-dev": {
"symfony/validator": "~2.4",
"symfony/validator": "~2.4,<2.5.0",
"symfony/http-foundation": "~2.2",
"symfony/http-kernel": "~2.4",
"symfony/security-csrf": "~2.4",

View File

@ -34,24 +34,4 @@ class BundleTest extends \PHPUnit_Framework_TestCase
$this->assertNull($bundle2->registerCommands($app));
}
public function testRegisterCommandsIngoreCommandAsAService()
{
$container = new ContainerBuilder();
$container->addCompilerPass(new AddConsoleCommandPass());
$definition = new Definition('Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionPresentBundle\Command\FooCommand');
$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);
}
}

View File

@ -22,7 +22,7 @@
"symfony/event-dispatcher": "~2.1",
"symfony/expression-language": "~2.4",
"symfony/http-foundation": "~2.4",
"symfony/validator": "~2.2",
"symfony/validator": "~2.2,<2.5.0",
"psr/log": "~1.0",
"ircmaxell/password-compat": "1.0.*"
},

View File

@ -29,7 +29,7 @@
},
"require-dev": {
"symfony/routing": "~2.2",
"symfony/validator": "~2.2",
"symfony/validator": "~2.2,<2.5.0",
"doctrine/common": "~2.2",
"doctrine/dbal": "~2.2",
"psr/log": "~1.0",

View File

@ -25,6 +25,7 @@
"symfony/intl": "~2.3",
"symfony/yaml": "~2.0",
"symfony/config": "~2.2",
"symfony/expression-language": "~2.4",
"doctrine/annotations": "~1.0",
"doctrine/cache": "~1.0"
},