fixed some composer.json to make standalone component tests pass
This commit is contained in:
parent
de780e88fd
commit
5c3cea59ba
@ -15,6 +15,7 @@ use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddConsoleComman
|
|||||||
use Symfony\Component\Console\Command\Command;
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\DependencyInjection\Definition;
|
use Symfony\Component\DependencyInjection\Definition;
|
||||||
|
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
||||||
|
|
||||||
class AddConsoleCommandPassTest extends \PHPUnit_Framework_TestCase
|
class AddConsoleCommandPassTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
@ -87,8 +88,32 @@ class AddConsoleCommandPassTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
$container->compile();
|
$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 MyCommand extends Command
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class ExtensionPresentBundle extends Bundle
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
"symfony/property-access": "~2.3"
|
"symfony/property-access": "~2.3"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"symfony/validator": "~2.4",
|
"symfony/validator": "~2.4,<2.5.0",
|
||||||
"symfony/http-foundation": "~2.2",
|
"symfony/http-foundation": "~2.2",
|
||||||
"symfony/http-kernel": "~2.4",
|
"symfony/http-kernel": "~2.4",
|
||||||
"symfony/security-csrf": "~2.4",
|
"symfony/security-csrf": "~2.4",
|
||||||
|
@ -34,24 +34,4 @@ class BundleTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
$this->assertNull($bundle2->registerCommands($app));
|
$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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
"symfony/event-dispatcher": "~2.1",
|
"symfony/event-dispatcher": "~2.1",
|
||||||
"symfony/expression-language": "~2.4",
|
"symfony/expression-language": "~2.4",
|
||||||
"symfony/http-foundation": "~2.4",
|
"symfony/http-foundation": "~2.4",
|
||||||
"symfony/validator": "~2.2",
|
"symfony/validator": "~2.2,<2.5.0",
|
||||||
"psr/log": "~1.0",
|
"psr/log": "~1.0",
|
||||||
"ircmaxell/password-compat": "1.0.*"
|
"ircmaxell/password-compat": "1.0.*"
|
||||||
},
|
},
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"symfony/routing": "~2.2",
|
"symfony/routing": "~2.2",
|
||||||
"symfony/validator": "~2.2",
|
"symfony/validator": "~2.2,<2.5.0",
|
||||||
"doctrine/common": "~2.2",
|
"doctrine/common": "~2.2",
|
||||||
"doctrine/dbal": "~2.2",
|
"doctrine/dbal": "~2.2",
|
||||||
"psr/log": "~1.0",
|
"psr/log": "~1.0",
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
"symfony/intl": "~2.3",
|
"symfony/intl": "~2.3",
|
||||||
"symfony/yaml": "~2.0",
|
"symfony/yaml": "~2.0",
|
||||||
"symfony/config": "~2.2",
|
"symfony/config": "~2.2",
|
||||||
|
"symfony/expression-language": "~2.4",
|
||||||
"doctrine/annotations": "~1.0",
|
"doctrine/annotations": "~1.0",
|
||||||
"doctrine/cache": "~1.0"
|
"doctrine/cache": "~1.0"
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user