@ -22,7 +22,6 @@ class RequestTest extends PHPUnit_Framework_TestCase
$_SERVER['REQUEST_METHOD'] = 'GET';
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest';
$_SERVER['REMOTE_ADDR'] = '8.8.8.8';
$_SERVER['HTTPS'] = 'on';
$_SERVER['HTTP_X_FORWARDED_FOR'] = '32.32.32.32';
$this->request = new \flight\net\Request();
@ -34,10 +33,10 @@ class RequestTest extends PHPUnit_Framework_TestCase
$this->assertEquals('GET', $this->request->method);
$this->assertEquals('', $this->request->referrer);
$this->assertEquals(true, $this->request->ajax);
$this->assertEquals('HTTP/1.1 ', $this->request->scheme);
$this->assertEquals('http ', $this->request->scheme);
$this->assertEquals('', $this->request->type);
$this->assertEquals(0, $this->request->length);
$this->assertEquals(tru e, $this->request->secure);
$this->assertEquals(fals e, $this->request->secure);
$this->assertEquals('', $this->request->accept);
}
@ -96,4 +95,34 @@ class RequestTest extends PHPUnit_Framework_TestCase
$this->assertEquals('PUT', $request->method);
}
function testHttps() {
$_SERVER['HTTPS'] = 'on';
$request = new \flight\net\Request();
$this->assertEquals('https', $request->scheme);
$_SERVER['HTTPS'] = 'off';
$request = new \flight\net\Request();
$this->assertEquals('http', $request->scheme);
$_SERVER['HTTP_X_FORWARDED_PROTO'] = 'https';
$request = new \flight\net\Request();
$this->assertEquals('https', $request->scheme);
$_SERVER['HTTP_X_FORWARDED_PROTO'] = 'http';
$request = new \flight\net\Request();
$this->assertEquals('http', $request->scheme);
$_SERVER['HTTP_FRONT_END_HTTPS'] = 'on';
$request = new \flight\net\Request();
$this->assertEquals('https', $request->scheme);
$_SERVER['HTTP_FRONT_END_HTTPS'] = 'off';
$request = new \flight\net\Request();
$this->assertEquals('http', $request->scheme);
$_SERVER['REQUEST_SCHEME'] = 'https';
$request = new \flight\net\Request();
$this->assertEquals('https', $request->scheme);
$_SERVER['REQUEST_SCHEME'] = 'http';
$request = new \flight\net\Request();
$this->assertEquals('http', $request->scheme);
}
}