Example #1
0
 public function testMethods()
 {
     $_SERVER['REQUEST_METHOD'] = 'GET';
     $r = new Request();
     $this->assertTrue($r->isGet());
     $_SERVER['REQUEST_METHOD'] = 'HEAD';
     $r = new Request();
     $this->assertTrue($r->isHead());
     $_SERVER['REQUEST_METHOD'] = 'POST';
     $r = new Request();
     $this->assertTrue($r->isPost());
     $_SERVER['REQUEST_METHOD'] = 'PUT';
     $r = new Request();
     $this->assertTrue($r->isPut());
     $_SERVER['REQUEST_METHOD'] = 'DELETE';
     $r = new Request();
     $this->assertTrue($r->isDelete());
     $_SERVER['REQUEST_METHOD'] = 'TRACE';
     $r = new Request();
     $this->assertTrue($r->isTrace());
     $_SERVER['REQUEST_METHOD'] = 'OPTIONS';
     $r = new Request();
     $this->assertTrue($r->isOptions());
     $_SERVER['REQUEST_METHOD'] = 'CONNECT';
     $r = new Request();
     $this->assertTrue($r->isConnect());
     $_SERVER['REQUEST_METHOD'] = 'PATCH';
     $r = new Request();
     $this->assertTrue($r->isPatch());
     $this->assertEquals('PATCH', $r->getMethod());
 }