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
c3248ebf
Commit
c3248ebf
authored
9 years ago
by
Tom Johnell
Browse files
Options
Downloads
Patches
Plain Diff
Added tests for getConfigDir
parent
087fcd84
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/ConfigTest.php
+49
-0
49 additions, 0 deletions
tests/lib/SimpleSAML/Utils/ConfigTest.php
with
49 additions
and
0 deletions
tests/lib/SimpleSAML/Utils/ConfigTest.php
0 → 100644
+
49
−
0
View file @
c3248ebf
<?php
/**
* Tests for SimpleSAML\Utils\Config
*/
class
Utils_ConfigTest
extends
PHPUnit_Framework_TestCase
{
/**
* Test default config dir with not environment variable
*/
public
function
testDefaultConfigDir
()
{
// clear env var
putenv
(
'SIMPLESAMLPHP_CONFIG_DIR'
);
$configDir
=
\SimpleSAML\Utils\Config
::
getConfigDir
();
$this
->
assertEquals
(
$configDir
,
dirname
(
dirname
(
dirname
(
dirname
(
__DIR__
))))
.
'/config'
);
}
/**
* Test valid dir specified by env var overrides default config dir
*/
public
function
testEnvVariableConfigDir
()
{
putenv
(
'SIMPLESAMLPHP_CONFIG_DIR='
.
__DIR__
);
$configDir
=
\SimpleSAML\Utils\Config
::
getConfigDir
();
$this
->
assertEquals
(
$configDir
,
__DIR__
);
}
/**
* Test invalid dir specified by env var results in a thrown exception
*/
public
function
testInvalidEnvVariableConfigDirThrowsException
()
{
// I used a random hash to ensure this test directory is always invalid
$invalidDir
=
__DIR__
.
'/e9826ad19cbc4f5bf20c0913ffcd2ce6'
;
putenv
(
'SIMPLESAMLPHP_CONFIG_DIR='
.
$invalidDir
);
$this
->
setExpectedException
(
'InvalidArgumentException'
,
'Config directory specified by environment variable SIMPLESAMLPHP_CONFIG_DIR is not a directory. '
.
'Given: "'
.
$invalidDir
.
'"'
);
$configDir
=
\SimpleSAML\Utils\Config
::
getConfigDir
();
}
}
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