Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
simplesamlphp
Manage
Activity
Members
Labels
Plan
Jira
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Perun
Perun ProxyIdP
v1
simplesamlphp
Commits
effecdc6
Unverified
Commit
effecdc6
authored
7 years ago
by
Tim van Dijen
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add test for getServerPort()
parent
a1bf3411
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/lib/SimpleSAML/Utils/HTTPTest.php
+36
-5
36 additions, 5 deletions
tests/lib/SimpleSAML/Utils/HTTPTest.php
with
36 additions
and
5 deletions
tests/lib/SimpleSAML/Utils/HTTPTest.php
+
36
−
5
View file @
effecdc6
...
@@ -6,8 +6,6 @@ use SimpleSAML\Utils\HTTP;
...
@@ -6,8 +6,6 @@ use SimpleSAML\Utils\HTTP;
class
HTTPTest
extends
TestCase
class
HTTPTest
extends
TestCase
{
{
/**
/**
* Set up the environment ($_SERVER) populating the typical variables from a given URL.
* Set up the environment ($_SERVER) populating the typical variables from a given URL.
*
*
...
@@ -120,7 +118,6 @@ class HTTPTest extends TestCase
...
@@ -120,7 +118,6 @@ class HTTPTest extends TestCase
$_SERVER
=
$original
;
$_SERVER
=
$original
;
}
}
/**
/**
* Test SimpleSAML\Utils\HTTP::getSelfHost() with and without custom port.
* Test SimpleSAML\Utils\HTTP::getSelfHost() with and without custom port.
*/
*/
...
@@ -166,7 +163,6 @@ class HTTPTest extends TestCase
...
@@ -166,7 +163,6 @@ class HTTPTest extends TestCase
$_SERVER
=
$original
;
$_SERVER
=
$original
;
}
}
/**
/**
* Test SimpleSAML\Utils\HTTP::getSelfURL().
* Test SimpleSAML\Utils\HTTP::getSelfURL().
*/
*/
...
@@ -292,7 +288,6 @@ class HTTPTest extends TestCase
...
@@ -292,7 +288,6 @@ class HTTPTest extends TestCase
$_SERVER
=
$original
;
$_SERVER
=
$original
;
}
}
/**
/**
* Test SimpleSAML\Utils\HTTP::checkURLAllowed(), without regex.
* Test SimpleSAML\Utils\HTTP::checkURLAllowed(), without regex.
*/
*/
...
@@ -355,6 +350,42 @@ class HTTPTest extends TestCase
...
@@ -355,6 +350,42 @@ class HTTPTest extends TestCase
$_SERVER
=
$original
;
$_SERVER
=
$original
;
}
}
/**
* Test SimpleSAML\Utils\HTTP::getServerPort().
*/
public
function
testGetServerPort
()
{
$original
=
$_SERVER
;
// Test HTTP + non-standard port
$_SERVER
[
'HTTPS'
]
=
'off'
;
$_SERVER
[
'SERVER_PORT'
]
=
'3030'
;
$this
->
assertEquals
(
HTTP
::
getServerPort
(),
':3030'
);
// Test HTTP + standard port
$_SERVER
[
'SERVER_PORT'
]
=
'80'
;
$this
->
assertEquals
(
HTTP
::
getServerPort
(),
''
);
// Test HTTP + without port
unset
(
$_SERVER
[
'SERVER_PORT'
]);
$this
->
assertEquals
(
HTTP
::
getServerPort
(),
''
);
// Test HTTPS + non-standard port
$_SERVER
[
'HTTPS'
]
=
'on'
;
$_SERVER
[
'SERVER_PORT'
]
=
'3030'
;
$this
->
assertEquals
(
HTTP
::
getServerPort
(),
':3030'
);
// Test HTTPS + standard port
$_SERVER
[
'SERVER_PORT'
]
=
'443'
;
$this
->
assertEquals
(
HTTP
::
getServerPort
(),
''
);
// Test HTTPS + without port
unset
(
$_SERVER
[
'SERVER_PORT'
]);
$this
->
assertEquals
(
HTTP
::
getServerPort
(),
''
);
$_SERVER
=
$original
;
}
/**
/**
* Test SimpleSAML\Utils\HTTP::checkURLAllowed(), with the regex as a
* Test SimpleSAML\Utils\HTTP::checkURLAllowed(), with the regex as a
* subdomain of an evil domain.
* subdomain of an evil domain.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment