private function _getScheme() { if ($schemeHeader = $this->_getSchemeHeader()) { return $schemeHeader; } else { $requestUrl = new Ergo_Http_Url($_SERVER['REQUEST_URI']); return $requestUrl->hasScheme() ? $requestUrl->getScheme() : 'http'; } }
public function testExceptionsThrown() { $url = new Ergo_Http_Url('/'); try { $url->getScheme(); $this->fail('getScheme() should throw exception'); } catch (Ergo_Http_UrlException $e) { $this->pass('getScheme() should throw exception'); } try { $url->getHost(); $this->fail('getHost() should throw exception'); } catch (Ergo_Http_UrlException $e) { $this->pass('getHost() should throw exception'); } }