From 39cb6616a2fb893b8739aae296e506e0aef88fc3 Mon Sep 17 00:00:00 2001 From: Abdellatif Ait boudad Date: Fri, 22 May 2015 19:35:43 +0000 Subject: [PATCH] [Framework][router commands] fixed failing test. --- .../Tests/Command/RouterDebugCommandTest.php | 17 +++++++++++------ .../Tests/Command/RouterMatchCommandTest.php | 19 +++++++++++-------- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterDebugCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterDebugCommandTest.php index bf5e183caa..584e56b99a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterDebugCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterDebugCommandTest.php @@ -56,7 +56,7 @@ class RouterDebugCommandTest extends \PHPUnit_Framework_TestCase $command->setContainer($this->getContainer()); $application->add($command); - return new CommandTester($application->find('router:debug')); + return new CommandTester($application->find('debug:router')); } private function getContainer() @@ -65,11 +65,15 @@ class RouterDebugCommandTest extends \PHPUnit_Framework_TestCase $routeCollection->add('foo', new Route('foo')); $router = $this->getMock('Symfony\Component\Routing\RouterInterface'); $router - ->expects($this->atLeastOnce()) + ->expects($this->any()) ->method('getRouteCollection') ->will($this->returnValue($routeCollection)) ; + $loader = $this->getMockBuilder('Symfony\Bundle\FrameworkBundle\Routing\DelegatingLoader') + ->disableOriginalConstructor() + ->getMock(); + $container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface'); $container ->expects($this->once()) @@ -77,12 +81,13 @@ class RouterDebugCommandTest extends \PHPUnit_Framework_TestCase ->with('router') ->will($this->returnValue(true)) ; + $container - ->expects($this->atLeastOnce()) ->method('get') - ->with('router') - ->will($this->returnValue($router)) - ; + ->will($this->returnValueMap(array( + array('router', 1, $router), + array('controller_name_converter', 1, $loader), + ))); return $container; } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterMatchCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterMatchCommandTest.php index 918ba02f6d..a1a661926c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterMatchCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterMatchCommandTest.php @@ -74,19 +74,22 @@ class RouterMatchCommandTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue($requestContext)) ; + $loader = $this->getMockBuilder('Symfony\Bundle\FrameworkBundle\Routing\DelegatingLoader') + ->disableOriginalConstructor() + ->getMock(); + $container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface'); $container ->expects($this->once()) ->method('has') ->with('router') - ->will($this->returnValue(true)) - ; - $container - ->expects($this->atLeastOnce()) - ->method('get') - ->with('router') - ->will($this->returnValue($router)) - ; + ->will($this->returnValue(true)); + $container->method('get') + ->will($this->returnValueMap(array( + array('router', 1, $router), + array('controller_name_converter', 1, $loader), + + ))); return $container; }