diff options
author | Andrés Blanco <ablanco@siu.edu.ar> | 2016-03-02 14:03:01 -0300 |
---|---|---|
committer | Andrés Blanco <ablanco@siu.edu.ar> | 2016-03-02 14:03:01 -0300 |
commit | 7ce18d59c208fb28baaef549280d09bf9b9dc903 (patch) | |
tree | dbfbfe01454f8eda8d1fc67b11ee76ca27a6aa82 /tests/lib/SimpleSAML/Utils/HTTPTest.php | |
parent | 07eef91329cf16f679598a086c9535579af51a02 (diff) | |
download | simplesamlphp-7ce18d59c208fb28baaef549280d09bf9b9dc903.zip simplesamlphp-7ce18d59c208fb28baaef549280d09bf9b9dc903.tar.gz simplesamlphp-7ce18d59c208fb28baaef549280d09bf9b9dc903.tar.bz2 |
Fixes issue 337
Diffstat (limited to 'tests/lib/SimpleSAML/Utils/HTTPTest.php')
-rw-r--r-- | tests/lib/SimpleSAML/Utils/HTTPTest.php | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/lib/SimpleSAML/Utils/HTTPTest.php b/tests/lib/SimpleSAML/Utils/HTTPTest.php new file mode 100644 index 0000000..b4e9845 --- /dev/null +++ b/tests/lib/SimpleSAML/Utils/HTTPTest.php @@ -0,0 +1,35 @@ +<?php +namespace SimpleSAML\Test\Utils; + +use SimpleSAML\Utils\HTTP; + +class HTTPTest extends \PHPUnit_Framework_TestCase +{ + /** + * Test HTTP::getSelfHost with and without custom port + */ + public function testGetSelfHost() + { + \SimpleSAML_Configuration::loadFromArray(array( + 'baseurlpath' => '', + ), '[ARRAY]', 'simplesaml'); + $_SERVER['SERVER_PORT'] = '80'; + $this->assertEquals('localhost', HTTP::getSelfHost()); + $_SERVER['SERVER_PORT'] = '3030'; + $this->assertEquals('localhost:3030', HTTP::getSelfHost()); + } + + /** + * Test HTTP::getSelfHostWithoutPort + */ + public function testGetSelfHostWithoutPort() + { + \SimpleSAML_Configuration::loadFromArray(array( + 'baseurlpath' => '', + ), '[ARRAY]', 'simplesaml'); + $_SERVER['SERVER_PORT'] = '80'; + $this->assertEquals('localhost', HTTP::getSelfHostWithoutPort()); + $_SERVER['SERVER_PORT'] = '3030'; + $this->assertEquals('localhost', HTTP::getSelfHostWithoutPort()); + } +} |