/** * 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 HTTP HEAD method detection */ public function testIsHead() { $env = Slim_Environment::mock(array('REQUEST_METHOD' => 'HEAD')); $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()); }
public function testIsPost() { $_SERVER['REQUEST_METHOD'] = 'POST'; $r = new Slim_Http_Request(); $this->assertTrue($r->isPost()); }