minor #14730 [Framework][router commands] fixed failing tests. (aitboudad)

This PR was merged into the 2.6 branch.

Discussion
----------

[Framework][router commands] fixed failing tests.

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Fixed tickets  | #14432
| Tests pass?   | yes
| License       | MIT

Commits
-------

39cb661 [Framework][router commands] fixed failing test.
This commit is contained in:
Fabien Potencier 2015-05-23 13:12:55 +02:00
commit 237996eb6e
2 changed files with 22 additions and 14 deletions

View File

@ -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;
}

View File

@ -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;
}