public function testRedirectToRoute() { $router = $this->getMock('Symfony\\Component\\Routing\\RouterInterface'); $router->expects($this->once())->method('generate')->willReturn('/foo'); $container = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerInterface'); $container->expects($this->at(0))->method('get')->will($this->returnValue($router)); $controller = new TestController(); $controller->setContainer($container); $response = $controller->redirectToRoute('foo'); $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\RedirectResponse', $response); $this->assertSame('/foo', $response->getTargetUrl()); $this->assertSame(302, $response->getStatusCode()); }