diff --git a/tests/src/OneLogin/Saml2/UtilsTest.php b/tests/src/OneLogin/Saml2/UtilsTest.php index ed117224..debb52e1 100644 --- a/tests/src/OneLogin/Saml2/UtilsTest.php +++ b/tests/src/OneLogin/Saml2/UtilsTest.php @@ -460,6 +460,9 @@ public function testSetBaseURLPath() { $this->assertNull(Utils::getBaseURLPath()); + Utils::setBaseURLPath('/'); + $this->assertEquals('/', Utils::getBaseURLPath()); + Utils::setBaseURLPath('sp'); $this->assertEquals('/sp/', Utils::getBaseURLPath()); @@ -473,6 +476,24 @@ public function testSetBaseURLPath() $this->assertEquals('/sp/', Utils::getBaseURLPath()); } + /** + * @covers OneLogin\Saml2\Utils::setBaseURLPath + */ + public function testSetBaseURLPath2() + { + $_SERVER['HTTP_HOST'] = 'sp.example.com'; + $_SERVER['HTTPS'] = 'https'; + $_SERVER['REQUEST_URI'] = null; + $_SERVER['QUERY_STRING'] = null; + $_SERVER['SCRIPT_NAME'] = '/'; + unset($_SERVER['PATH_INFO']); + Utils::setBaseURLPath('/'); + $this->assertEquals("https://sp.example.com/", Utils::getSelfURLNoQuery()); + $this->assertEquals("https://sp.example.com/", Utils::getSelfRoutedURLNoQuery()); + $this->assertEquals("https://sp.example.com/", Utils::getSelfURL()); + $this->assertEquals('/', Utils::getBaseURLPath()); + } + /** * @covers OneLogin\Saml2\Utils::setBaseURL *