Skip to content

Commit 580371f

Browse files
committed
Add more tests
1 parent ed38230 commit 580371f

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/src/OneLogin/Saml2/UtilsTest.php

+22
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,25 @@ 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+
491+
Utils::setBaseURLPath('/');
492+
$this->assertEquals("https://sp.example.com/", Utils::getSelfURLNoQuery());
493+
$this->assertEquals("https://sp.example.com/", Utils::getSelfRoutedURLNoQuery());
494+
$this->assertEquals("https://sp.example.com/", Utils::getSelfURL());
495+
$this->assertEquals('/', Utils::getBaseURLPath());
496+
}
497+
476498
/**
477499
* @covers OneLogin\Saml2\Utils::setBaseURL
478500
*

0 commit comments

Comments
 (0)