Example #1
0
 /**
  * Test HTTP HEAD method detection
  */
 public function testIsHead()
 {
     Slim_Environment::mock(array('REQUEST_METHOD' => 'HEAD', 'REMOTE_ADDR' => '127.0.0.1', 'SCRIPT_NAME' => '/foo/index.php', 'PATH_INFO' => '/bar/xyz', 'QUERY_STRING' => 'one=1&two=2&three=3', 'SERVER_NAME' => 'slim', 'SERVER_PORT' => 80, 'slim.url_scheme' => 'http', 'slim.input' => '', 'slim.errors' => fopen('php://stderr', 'w')));
     $env = Slim_Environment::getInstance();
     $req = new Slim_Http_Request($env);
     $this->assertFalse($req->isGet());
     $this->assertFalse($req->isPost());
     $this->assertFalse($req->isPut());
     $this->assertFalse($req->isDelete());
     $this->assertFalse($req->isOptions());
     $this->assertTrue($req->isHead());
 }
Example #2
0
 /**
  * Test is form data
  */
 public function testIsFormDataPostContentUnknownWithMethodOverride()
 {
     $env = Slim_Environment::mock(array('REQUEST_METHOD' => 'PUT'));
     $env['slim.method_override.original_method'] = 'POST';
     $req = new Slim_Http_Request($env);
     $this->assertTrue($req->isPut());
     $this->assertTrue($req->isFormData());
 }
Example #3
0
 public function testIsPut()
 {
     //Case A
     $_SERVER['REQUEST_METHOD'] = 'PUT';
     $r = new Slim_Http_Request();
     $this->assertTrue($r->isPut());
     //Case B
     $_POST['_METHOD'] = 'PUT';
     $_SERVER['REQUEST_METHOD'] = 'POST';
     $r = new Slim_Http_Request();
     $this->assertTrue($r->isPut());
 }