public function testHttpRequestPort()
{
$this->specify("http host with https on does not return expected port", function () {
$request = $this->getRequestObject();
$this->setServerVar('HTTPS', 'on');
$this->setServerVar('HTTP_HOST', 'example.com');
expect($request->getPort())->equals(443);
});
$this->specify("http host with https off does not return expected port", function () {
$request = $this->getRequestObject();
$this->setServerVar('HTTPS', 'off');
$this->setServerVar('HTTP_HOST', 'example.com');
expect($request->getPort())->equals(80);
});
$this->specify("http host with port on HTTP_HOST does not return expected port", function () {
$request = $this->getRequestObject();
$this->setServerVar('HTTPS', 'off');
$this->setServerVar('HTTP_HOST', 'example.com:8080');
expect($request->getPort())->equals(8080);
$this->setServerVar('HTTPS', 'on');
$this->setServerVar('HTTP_HOST', 'example.com:8081');
expect($request->getPort())->equals(8081);
unset($_SERVER['HTTPS']);
$this->setServerVar('HTTP_HOST', 'example.com:8082');
expect($request->getPort())->equals(8082);
});
}