Example #1
0
 public function testMatchMethod()
 {
     // all
     $route = new Route("/");
     $this->assertTrue($route->matchMethod("GET"));
     $this->assertTrue($route->matchMethod("HEAD"));
     $this->assertTrue($route->matchMethod("POST"));
     $this->assertTrue($route->matchMethod("PUT"));
     $this->assertTrue($route->matchMethod("DELETE"));
     $this->assertTrue($route->matchMethod("OPTIONS"));
     $this->assertTrue($route->matchMethod("get"));
     $this->assertTrue($route->matchMethod("post"));
     // GET
     $route->setMethod("GET");
     $this->assertTrue($route->matchMethod("GET"));
     $this->assertTrue($route->matchMethod("get"));
     $this->assertFalse($route->matchMethod("POST"));
     $this->assertFalse($route->matchMethod("put"));
     // POST
     $route->setMethod("post");
     $this->assertTrue($route->matchMethod("POST"));
     $this->assertTrue($route->matchMethod("post"));
     $this->assertFalse($route->matchMethod("GET"));
     $this->assertFalse($route->matchMethod("put"));
 }