You are here

public function ProviderBasedGeneratorTest::testGenerateByRoute in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony-cmf/routing/Tests/Routing/ProviderBasedGeneratorTest.php \Symfony\Cmf\Component\Routing\Tests\Routing\ProviderBasedGeneratorTest::testGenerateByRoute()

Tests the generate method with passing in a route object into generate().

@expectedException \Symfony\Component\Routing\Exception\InvalidParameterException

File

vendor/symfony-cmf/routing/Tests/Routing/ProviderBasedGeneratorTest.php, line 107

Class

ProviderBasedGeneratorTest

Namespace

Symfony\Cmf\Component\Routing\Tests\Routing

Code

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',
  )));
}