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
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
2e229475
Commit
2e229475
authored
9 years ago
by
Jaime Perez Crespo
Browse files
Options
Downloads
Patches
Plain Diff
Fix tests for SimpleSAML\Utils\Attributes::getExpectedAttribute().
parent
53bbb493
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/AttributesTest.php
+43
-4
43 additions, 4 deletions
tests/lib/SimpleSAML/Utils/AttributesTest.php
with
43 additions
and
4 deletions
tests/lib/SimpleSAML/Utils/AttributesTest.php
+
43
−
4
View file @
2e229475
...
...
@@ -10,9 +10,9 @@ class Utils_AttributesTest extends PHPUnit_Framework_TestCase
{
/**
* Test the getExpectedAttribute()
function
with invalid
input
.
* Test the getExpectedAttribute()
method
with invalid
attributes array
.
*/
public
function
testGetExpectedAttributeInvalid
Input
()
public
function
testGetExpectedAttributeInvalid
AttributesArray
()
{
// check with empty array as input
$attributes
=
'string'
;
...
...
@@ -22,7 +22,14 @@ class Utils_AttributesTest extends PHPUnit_Framework_TestCase
'The attributes array is not an array, it is: '
.
print_r
(
$attributes
,
true
)
.
'.'
);
\SimpleSAML\Utils\Attributes
::
getExpectedAttribute
(
$attributes
,
$expected
);
}
/**
* Test the getExpectedAttributeMethod() method with invalid expected attribute parameter.
*/
public
function
testGetExpectedAttributeInvalidAttributeName
()
{
// check with invalid attribute name
$attributes
=
array
();
$expected
=
false
;
...
...
@@ -31,7 +38,14 @@ class Utils_AttributesTest extends PHPUnit_Framework_TestCase
'The expected attribute is not a string, it is: '
.
print_r
(
$expected
,
true
)
.
'.'
);
\SimpleSAML\Utils\Attributes
::
getExpectedAttribute
(
$attributes
,
$expected
);
}
/**
* Test the getExpectedAttributeMethod() method with a non-normalized attributes array.
*/
public
function
testGetExpectedAttributeNonNormalizedArray
()
{
// check with non-normalized attributes array
$attributes
=
array
(
'attribute'
=>
'value'
,
...
...
@@ -46,9 +60,9 @@ class Utils_AttributesTest extends PHPUnit_Framework_TestCase
/**
* Test the getExpectedAttribute() with valid input
that raises exceptions
.
* Test the getExpectedAttribute()
method
with valid input
but missing expected attribute
.
*/
public
function
testGetExpectedAttribute
ErrorConditions
()
public
function
testGetExpectedAttribute
MissingAttribute
()
{
// check missing attribute
$attributes
=
array
(
...
...
@@ -60,7 +74,32 @@ class Utils_AttributesTest extends PHPUnit_Framework_TestCase
"No such attribute '"
.
$expected
.
"' found."
);
\SimpleSAML\Utils\Attributes
::
getExpectedAttribute
(
$attributes
,
$expected
);
}
/**
* Test the getExpectedAttribute() method with an empty attribute.
*/
public
function
testGetExpectedAttributeEmptyAttribute
()
{
// check empty attribute
$attributes
=
array
(
'attribute'
=>
array
(),
);
$expected
=
'attribute'
;
$this
->
setExpectedException
(
'SimpleSAML_Error_Exception'
,
"Empty attribute '"
.
$expected
.
"'.'"
);
\SimpleSAML\Utils\Attributes
::
getExpectedAttribute
(
$attributes
,
$expected
);
}
/**
* Test the getExpectedAttributeMethod() method with multiple values (not being allowed).
*/
public
function
testGetExpectedAttributeMultipleValues
()
{
// check attribute with more than value, that being not allowed
$attributes
=
array
(
'attribute'
=>
array
(
...
...
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