/** * 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()); }
/** * 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()); }
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()); }