/** * @expectedException \Symfony\Component\Routing\Exception\RouteNotFoundException */ public function testGetRouteByNameNotCandidate() { $this->objectRepositoryMock->expects($this->never())->method('findOneBy'); $candidatesMock = $this->getMock('Symfony\\Cmf\\Component\\Routing\\Candidates\\CandidatesInterface'); $candidatesMock->expects($this->once())->method('isCandidate')->with('/test-route')->will($this->returnValue(false)); $routeProvider = new RouteProvider($this->managerRegistryMock, $candidatesMock, 'Route'); $routeProvider->setManagerName('default'); $routeProvider->getRouteByName('/test-route'); }