Skip to content

Commit 216ca81

Browse files
committed
Fix tests after fix buildWithBaseURLPath
1 parent 9d6ccc0 commit 216ca81

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

tests/src/OneLogin/Saml2/UtilsTest.php

+24-4
Original file line numberDiff line numberDiff line change
@@ -503,9 +503,9 @@ public function testSetBaseURL()
503503
$this->assertEquals($expectedUrl, Utils::getSelfURL());
504504

505505
Utils::setBaseURL("http://anothersp.example.com:81/example2/");
506-
$expectedUrlNQ2 = 'http://anothersp.example.com:81/example2/route.php';
507-
$expectedRoutedUrlNQ2 = 'http://anothersp.example.com:81/example2/route.php';
508-
$expectedUrl2 = 'http://anothersp.example.com:81/example2/route.php?x=test';
506+
$expectedUrlNQ2 = 'http://anothersp.example.com:81/example2/example1/route.php';
507+
$expectedRoutedUrlNQ2 = 'http://anothersp.example.com:81/example2/example1/route.php';
508+
$expectedUrl2 = 'http://anothersp.example.com:81/example2/example1/route.php?x=test';
509509

510510
$this->assertEquals('http', Utils::getSelfProtocol());
511511
$this->assertEquals('anothersp.example.com', Utils::getSelfHost());
@@ -517,13 +517,33 @@ public function testSetBaseURL()
517517
$this->assertEquals($expectedUrl2, Utils::getSelfURL());
518518

519519
$_SERVER['PATH_INFO'] = '/test';
520-
$expectedUrlNQ2 = 'http://anothersp.example.com:81/example2/route.php/test';
520+
$expectedUrlNQ2 = 'http://anothersp.example.com:81/example2/example1/route.php/test';
521521

522522
$this->assertEquals($expectedUrlNQ2, Utils::getSelfURLNoQuery());
523523
$this->assertEquals($expectedRoutedUrlNQ2, Utils::getSelfRoutedURLNoQuery());
524524
$this->assertEquals($expectedUrl2, Utils::getSelfURL());
525525
}
526526

527+
/**
528+
* Tests the buildWithBaseURLPath method of the Utils
529+
*
530+
* @covers OneLogin\Saml2\Utils::buildWithBaseURLPath
531+
*
532+
* @runInSeparateProcess
533+
* @preserveGlobalState disabled
534+
*/
535+
public function testBuildWithBaseURLPath()
536+
{
537+
$class = new \ReflectionClass("Utils");
538+
$method = $class->getMethod("buildWithBaseURLPath");
539+
540+
Utils::setBaseURL("http://sp.example.com:81/");
541+
$result = Utils::buildWithBaseURLPath();
542+
543+
$this->assertEquals("", $result);
544+
}
545+
546+
527547
/**
528548
* Tests the getSelfURLhost method of the Utils
529549
*

0 commit comments

Comments
 (0)