OneLogin_Saml2_Utils::setSelfPort PHP Method

setSelfPort() public static method

public static setSelfPort ( $port )
$port int The port number to use when constructing URLs
    public static function setSelfPort($port)
    {
        self::$_port = $port;
    }

Usage Example

Example #1
0
 /**
  * @covers OneLogin_Saml2_Utils::getSelfPort
  */
 public function testGetselfPort()
 {
     $this->assertNull(OneLogin_Saml2_Utils::getSelfPort());
     $_SERVER['HTTP_HOST'] = 'example.org:ok';
     $this->assertNull(OneLogin_Saml2_Utils::getSelfPort());
     $_SERVER['HTTP_HOST'] = 'example.org:8080';
     $this->assertEquals(8080, OneLogin_Saml2_Utils::getSelfPort());
     $_SERVER["SERVER_PORT"] = 80;
     $this->assertEquals(80, OneLogin_Saml2_Utils::getSelfPort());
     $_SERVER["HTTP_X_FORWARDED_PORT"] = 443;
     $this->assertEquals(80, OneLogin_Saml2_Utils::getSelfPort());
     OneLogin_Saml2_Utils::setProxyVars(true);
     $this->assertEquals(443, OneLogin_Saml2_Utils::getSelfPort());
     OneLogin_Saml2_Utils::setSelfPort(8080);
     $this->assertEquals(8080, OneLogin_Saml2_Utils::getSelfPort());
 }