[2.7] [FrameworkBundle] minor fix tests added by #17569
This commit is contained in:
parent
653428af76
commit
ce6e5ac5aa
@ -24,7 +24,7 @@ class ApplicationTest extends TestCase
|
|||||||
{
|
{
|
||||||
$bundle = $this->getMock('Symfony\Component\HttpKernel\Bundle\BundleInterface');
|
$bundle = $this->getMock('Symfony\Component\HttpKernel\Bundle\BundleInterface');
|
||||||
|
|
||||||
$kernel = $this->getKernel(array($bundle));
|
$kernel = $this->getKernel(array($bundle), true);
|
||||||
|
|
||||||
$application = new Application($kernel);
|
$application = new Application($kernel);
|
||||||
$application->doRun(new ArrayInput(array('list')), new NullOutput());
|
$application->doRun(new ArrayInput(array('list')), new NullOutput());
|
||||||
@ -35,7 +35,7 @@ class ApplicationTest extends TestCase
|
|||||||
$bundle = $this->getMock('Symfony\Component\HttpKernel\Bundle\Bundle');
|
$bundle = $this->getMock('Symfony\Component\HttpKernel\Bundle\Bundle');
|
||||||
$bundle->expects($this->once())->method('registerCommands');
|
$bundle->expects($this->once())->method('registerCommands');
|
||||||
|
|
||||||
$kernel = $this->getKernel(array($bundle));
|
$kernel = $this->getKernel(array($bundle), true);
|
||||||
|
|
||||||
$application = new Application($kernel);
|
$application = new Application($kernel);
|
||||||
$application->doRun(new ArrayInput(array('list')), new NullOutput());
|
$application->doRun(new ArrayInput(array('list')), new NullOutput());
|
||||||
@ -49,12 +49,7 @@ class ApplicationTest extends TestCase
|
|||||||
$bundle = $this->getMock('Symfony\Component\HttpKernel\Bundle\Bundle');
|
$bundle = $this->getMock('Symfony\Component\HttpKernel\Bundle\Bundle');
|
||||||
$bundle->expects($this->once())->method('registerCommands');
|
$bundle->expects($this->once())->method('registerCommands');
|
||||||
|
|
||||||
$kernel = $this->getMock('Symfony\Component\HttpKernel\KernelInterface');
|
$kernel = $this->getKernel(array($bundle));
|
||||||
$kernel
|
|
||||||
->expects($this->any())
|
|
||||||
->method('getBundles')
|
|
||||||
->will($this->returnValue(array($bundle)))
|
|
||||||
;
|
|
||||||
|
|
||||||
$application = new Application($kernel);
|
$application = new Application($kernel);
|
||||||
$application->all();
|
$application->all();
|
||||||
@ -68,12 +63,7 @@ class ApplicationTest extends TestCase
|
|||||||
$bundle = $this->getMock('Symfony\Component\HttpKernel\Bundle\Bundle');
|
$bundle = $this->getMock('Symfony\Component\HttpKernel\Bundle\Bundle');
|
||||||
$bundle->expects($this->once())->method('registerCommands');
|
$bundle->expects($this->once())->method('registerCommands');
|
||||||
|
|
||||||
$kernel = $this->getMock('Symfony\Component\HttpKernel\KernelInterface');
|
$kernel = $this->getKernel(array($bundle));
|
||||||
$kernel
|
|
||||||
->expects($this->any())
|
|
||||||
->method('getBundles')
|
|
||||||
->will($this->returnValue(array($bundle)))
|
|
||||||
;
|
|
||||||
|
|
||||||
$application = new Application($kernel);
|
$application = new Application($kernel);
|
||||||
|
|
||||||
@ -88,12 +78,7 @@ class ApplicationTest extends TestCase
|
|||||||
$bundle = $this->getMock('Symfony\Component\HttpKernel\Bundle\Bundle');
|
$bundle = $this->getMock('Symfony\Component\HttpKernel\Bundle\Bundle');
|
||||||
$bundle->expects($this->once())->method('registerCommands');
|
$bundle->expects($this->once())->method('registerCommands');
|
||||||
|
|
||||||
$kernel = $this->getMock('Symfony\Component\HttpKernel\KernelInterface');
|
$kernel = $this->getKernel(array($bundle));
|
||||||
$kernel
|
|
||||||
->expects($this->any())
|
|
||||||
->method('getBundles')
|
|
||||||
->will($this->returnValue(array($bundle)))
|
|
||||||
;
|
|
||||||
|
|
||||||
$application = new Application($kernel);
|
$application = new Application($kernel);
|
||||||
|
|
||||||
@ -108,12 +93,7 @@ class ApplicationTest extends TestCase
|
|||||||
$bundle = $this->getMock('Symfony\Component\HttpKernel\Bundle\Bundle');
|
$bundle = $this->getMock('Symfony\Component\HttpKernel\Bundle\Bundle');
|
||||||
$bundle->expects($this->once())->method('registerCommands');
|
$bundle->expects($this->once())->method('registerCommands');
|
||||||
|
|
||||||
$kernel = $this->getMock('Symfony\Component\HttpKernel\KernelInterface');
|
$kernel = $this->getKernel(array($bundle));
|
||||||
$kernel
|
|
||||||
->expects($this->any())
|
|
||||||
->method('getBundles')
|
|
||||||
->will($this->returnValue(array($bundle)))
|
|
||||||
;
|
|
||||||
|
|
||||||
$application = new Application($kernel);
|
$application = new Application($kernel);
|
||||||
|
|
||||||
@ -130,7 +110,7 @@ class ApplicationTest extends TestCase
|
|||||||
$command->setCode(function () {});
|
$command->setCode(function () {});
|
||||||
$command->expects($this->exactly(2))->method('setContainer');
|
$command->expects($this->exactly(2))->method('setContainer');
|
||||||
|
|
||||||
$application = new Application($this->getKernel(array()));
|
$application = new Application($this->getKernel(array(), true));
|
||||||
$application->setAutoExit(false);
|
$application->setAutoExit(false);
|
||||||
$application->setCatchExceptions(false);
|
$application->setCatchExceptions(false);
|
||||||
$application->add($command);
|
$application->add($command);
|
||||||
@ -143,21 +123,23 @@ class ApplicationTest extends TestCase
|
|||||||
$tester->run(array('command' => 'foo'));
|
$tester->run(array('command' => 'foo'));
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getKernel(array $bundles)
|
private function getKernel(array $bundles, $useDispatcher = false)
|
||||||
{
|
{
|
||||||
|
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||||
|
|
||||||
|
if ($useDispatcher) {
|
||||||
$dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
|
$dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
|
||||||
$dispatcher
|
$dispatcher
|
||||||
->expects($this->atLeastOnce())
|
->expects($this->atLeastOnce())
|
||||||
->method('dispatch')
|
->method('dispatch')
|
||||||
;
|
;
|
||||||
|
|
||||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
|
||||||
$container
|
$container
|
||||||
->expects($this->atLeastOnce())
|
->expects($this->atLeastOnce())
|
||||||
->method('get')
|
->method('get')
|
||||||
->with($this->equalTo('event_dispatcher'))
|
->with($this->equalTo('event_dispatcher'))
|
||||||
->will($this->returnValue($dispatcher))
|
->will($this->returnValue($dispatcher));
|
||||||
;
|
}
|
||||||
|
|
||||||
$container
|
$container
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('hasParameter')
|
->method('hasParameter')
|
||||||
|
Reference in New Issue
Block a user