Exemplo n.º 1
0
 public function testgetPatterngetDefaultsgetOptionsgetRequirements()
 {
     $route = new Route('/{foo}', array('foo' => 'bar'), array('foo' => '\\d+'), array('foo' => 'bar'));
     $compiled = new CompiledRoute($route, 'prefix', 'regex', array('tokens'), array('variables'));
     $this->assertEquals('/{foo}', $compiled->getPattern(), '->getPattern() returns the route pattern');
     $this->assertEquals(array('foo' => 'bar'), $compiled->getDefaults(), '->getDefaults() returns the route defaults');
     $this->assertEquals(array('foo' => '\\d+'), $compiled->getRequirements(), '->getRequirements() returns the route requirements');
     $this->assertEquals(array_merge(array('compiler_class' => 'Symfony\\Component\\Routing\\RouteCompiler'), array('foo' => 'bar')), $compiled->getOptions(), '->getOptions() returns the route options');
 }
Exemplo n.º 2
0
 public function testgetPatterngetDefaultsgetOptionsgetRequirements()
 {
     $route = new Route('/:foo', array('foo' => 'bar'), array('foo' => '\\d+'), array('foo' => 'bar'));
     $compiled = new CompiledRoute($route, 'prefix', 'regex', array('tokens'), array('variables'));
     $this->assertEquals('/:foo', $compiled->getPattern(), '->getPattern() returns the route pattern');
     $this->assertEquals(array('foo' => 'bar'), $compiled->getDefaults(), '->getDefaults() returns the route defaults');
     $this->assertEquals(array('foo' => '\\d+'), $compiled->getRequirements(), '->getRequirements() returns the route requirements');
     $this->assertEquals(array_merge(array('variable_prefixes' => array(':'), 'segment_separators' => array('/', '.'), 'variable_regex' => '[\\w\\d_]+', 'text_regex' => '.+?', 'compiler_class' => 'Symfony\\Component\\Routing\\RouteCompiler'), array('foo' => 'bar')), $compiled->getOptions(), '->getOptions() returns the route options');
 }