Example #1
0
 /**
  * Test parsing routes with extensions.
  *
  * @return void
  */
 public function testRouteParsingWithExtensions()
 {
     $route = new Route('/:controller/:action/*', array(), array('_ext' => array('json', 'xml')));
     $result = $route->parse('/posts/index');
     $this->assertFalse(isset($result['_ext']));
     $result = $route->parse('/posts/index.pdf');
     $this->assertFalse(isset($result['_ext']));
     $route->parseExtensions(array('pdf', 'json', 'xml'));
     $result = $route->parse('/posts/index.pdf');
     $this->assertEquals('pdf', $result['_ext']);
     $result = $route->parse('/posts/index.json');
     $this->assertEquals('json', $result['_ext']);
     $result = $route->parse('/posts/index.xml');
     $this->assertEquals('xml', $result['_ext']);
 }