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 ed38230 commit 580371f
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 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,25 @@ 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 580371f

Please sign in to comment.