/** * Tests the generate method with passing in a route object into generate(). * * @expectedException \Symfony\Component\Routing\Exception\InvalidParameterException */ public function testGenerateByRoute() { $this->generator = new ProviderBasedGenerator($this->provider); // Setup a route with a numeric parameter, but pass in a string, so it // fails and getRouteDebugMessage should be triggered. $route = new Route('/test'); $route->setPath('/test/{number}'); $route->setRequirement('number', '\\+d'); $this->generator->setStrictRequirements(true); $context = new RequestContext(); $this->generator->setContext($context); $this->assertSame(null, $this->generator->generate($route, array('number' => 'string'))); }