Skip to content

Commit 17db2d0

Browse files
committed
[Framework][router commands] fixed failing test.
1 parent 3f83723 commit 17db2d0

File tree

2 files changed

+22
-14
lines changed

2 files changed

+22
-14
lines changed

Tests/Command/RouterDebugCommandTest.php

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ private function createCommandTester()
5656
$command->setContainer($this->getContainer());
5757
$application->add($command);
5858

59-
return new CommandTester($application->find('router:debug'));
59+
return new CommandTester($application->find('debug:router'));
6060
}
6161

6262
private function getContainer()
@@ -65,24 +65,29 @@ private function getContainer()
6565
$routeCollection->add('foo', new Route('foo'));
6666
$router = $this->getMock('Symfony\Component\Routing\RouterInterface');
6767
$router
68-
->expects($this->atLeastOnce())
68+
->expects($this->any())
6969
->method('getRouteCollection')
7070
->will($this->returnValue($routeCollection))
7171
;
7272

73+
$loader = $this->getMockBuilder('Symfony\Bundle\FrameworkBundle\Routing\DelegatingLoader')
74+
->disableOriginalConstructor()
75+
->getMock();
76+
7377
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
7478
$container
7579
->expects($this->once())
7680
->method('has')
7781
->with('router')
7882
->will($this->returnValue(true))
7983
;
84+
8085
$container
81-
->expects($this->atLeastOnce())
8286
->method('get')
83-
->with('router')
84-
->will($this->returnValue($router))
85-
;
87+
->will($this->returnValueMap(array(
88+
array('router', 1, $router),
89+
array('controller_name_converter', 1, $loader),
90+
)));
8691

8792
return $container;
8893
}

Tests/Command/RouterMatchCommandTest.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,19 +74,22 @@ private function getContainer()
7474
->will($this->returnValue($requestContext))
7575
;
7676

77+
$loader = $this->getMockBuilder('Symfony\Bundle\FrameworkBundle\Routing\DelegatingLoader')
78+
->disableOriginalConstructor()
79+
->getMock();
80+
7781
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
7882
$container
7983
->expects($this->once())
8084
->method('has')
8185
->with('router')
82-
->will($this->returnValue(true))
83-
;
84-
$container
85-
->expects($this->atLeastOnce())
86-
->method('get')
87-
->with('router')
88-
->will($this->returnValue($router))
89-
;
86+
->will($this->returnValue(true));
87+
$container->method('get')
88+
->will($this->returnValueMap(array(
89+
array('router', 1, $router),
90+
array('controller_name_converter', 1, $loader),
91+
92+
)));
9093

9194
return $container;
9295
}

0 commit comments

Comments
 (0)