Example #1
0
 public function testMatchPathWithSpecialFormat()
 {
     $route = new Route("/path/to/file.{_format}", array("_format" => ""));
     $this->assertTrue($route->matchPath("/path/to/file.php"));
     $this->assertTrue($route->matchPath("/path/to/file"));
     // fails
     $this->assertFalse($route->matchPath("/path/to/filephp"));
     $this->assertFalse($route->matchPath("/path/to/file."));
     // only some formats allowed
     $route->setRequisite("_format", "php|html");
     $this->assertTrue($route->matchPath("/path/to/file.php"));
     $this->assertTrue($route->matchPath("/path/to/file.html"));
     $this->assertTrue($route->matchPath("/path/to/file"));
     // fails
     $this->assertFalse($route->matchPath("/path/to/filephp"));
     $this->assertFalse($route->matchPath("/path/to/file."));
     $this->assertFalse($route->matchPath("/path/to/file.js"));
     $this->assertFalse($route->matchPath("/path/to/file.aspx"));
 }