Skip to content

Commit 9a831a6

Browse files
committed
Add more tests
1 parent 964e420 commit 9a831a6

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/src/OneLogin/Saml2/UtilsTest.php

+21
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,9 @@ public function testSetBaseURLPath()
460460
{
461461
$this->assertNull(Utils::getBaseURLPath());
462462

463+
Utils::setBaseURLPath('/');
464+
$this->assertEquals('/', Utils::getBaseURLPath());
465+
463466
Utils::setBaseURLPath('sp');
464467
$this->assertEquals('/sp/', Utils::getBaseURLPath());
465468

@@ -473,6 +476,24 @@ public function testSetBaseURLPath()
473476
$this->assertEquals('/sp/', Utils::getBaseURLPath());
474477
}
475478

479+
/**
480+
* @covers OneLogin\Saml2\Utils::setBaseURLPath
481+
*/
482+
public function testSetBaseURLPath2()
483+
{
484+
$_SERVER['HTTP_HOST'] = 'sp.example.com';
485+
$_SERVER['HTTPS'] = 'https';
486+
$_SERVER['REQUEST_URI'] = null;
487+
$_SERVER['QUERY_STRING'] = null;
488+
$_SERVER['SCRIPT_NAME'] = '/';
489+
unset($_SERVER['PATH_INFO']);
490+
Utils::setBaseURLPath('/');
491+
$this->assertEquals("https://sp.example.com/", Utils::getSelfURLNoQuery());
492+
$this->assertEquals("https://sp.example.com/", Utils::getSelfRoutedURLNoQuery());
493+
$this->assertEquals("https://sp.example.com/", Utils::getSelfURL());
494+
$this->assertEquals('/', Utils::getBaseURLPath());
495+
}
496+
476497
/**
477498
* @covers OneLogin\Saml2\Utils::setBaseURL
478499
*

0 commit comments

Comments
 (0)