Skip to content

Commit

Permalink
Add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pitbulk committed Sep 29, 2024
1 parent 964e420 commit 9a831a6
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/src/OneLogin/Saml2/UtilsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand All @@ -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
*
Expand Down

0 comments on commit 9a831a6

Please sign in to comment.