public function testGetContentType() { //Case A $_SERVER['CONTENT_TYPE'] = 'application/json'; $r1 = new Slim_Http_Request(); $this->assertEquals($_SERVER['CONTENT_TYPE'], $r1->getContentType()); //Case B unset($_SERVER['CONTENT_TYPE']); $r2 = new Slim_Http_Request(); $this->assertEquals('application/x-www-form-urlencoded', $r2->getContentType()); //Case C $_SERVER['CONTENT_TYPE'] = 'text/html; charset=ISO-8859-4'; $r3 = new Slim_Http_Request(); $this->assertEquals('text/html', $r3->getContentType()); }
/** * Test get content type */ public function testGetContentTypeWhenNotExists() { $env = Slim_Environment::mock(); $req = new Slim_Http_Request($env); $this->assertNull($req->getContentType()); }
public function testGetContentType() { //Case A $_SERVER['CONTENT_TYPE'] = 'application/json'; $r = new Slim_Http_Request(); $this->assertEquals($_SERVER['CONTENT_TYPE'], $r->getContentType()); //Case B unset($_SERVER['CONTENT_TYPE']); $r = new Slim_Http_Request(); $this->assertEquals('application/x-www-form-urlencoded', $r->getContentType()); }