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
892a67a5
Commit
892a67a5
authored
5 years ago
by
Tim van Dijen
Browse files
Options
Downloads
Patches
Plain Diff
Fix TooManyArguments
parent
db5dcdac
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/lib/SimpleSAML/Utils/AttributesTest.php
+16
-19
16 additions, 19 deletions
tests/lib/SimpleSAML/Utils/AttributesTest.php
with
16 additions
and
19 deletions
tests/lib/SimpleSAML/Utils/AttributesTest.php
+
16
−
19
View file @
892a67a5
...
...
@@ -2,6 +2,7 @@
namespace
SimpleSAML\Test\Utils
;
use
InvalidArgumentException
;
use
PHPUnit\Framework\TestCase
;
use
SimpleSAML\Utils\Attributes
;
...
...
@@ -21,8 +22,8 @@ class AttributesTest extends TestCase
// check with empty array as input
$attributes
=
'string'
;
$expected
=
'string'
;
$this
->
expectException
(
\InvalidArgumen
tException
::
class
,
$this
->
expectException
(
InvalidArgumentException
::
class
);
$this
->
expec
tException
Message
(
'The attributes array is not an array, it is: '
.
print_r
(
$attributes
,
true
)
.
'.'
);
Attributes
::
getExpectedAttribute
(
$attributes
,
$expected
);
...
...
@@ -38,8 +39,8 @@ class AttributesTest extends TestCase
// check with invalid attribute name
$attributes
=
[];
$expected
=
false
;
$this
->
expectException
(
\InvalidArgumen
tException
::
class
,
$this
->
expectException
(
InvalidArgumentException
::
class
);
$this
->
expec
tException
Message
(
'The expected attribute is not a string, it is: '
.
print_r
(
$expected
,
true
)
.
'.'
);
Attributes
::
getExpectedAttribute
(
$attributes
,
$expected
);
...
...
@@ -57,8 +58,8 @@ class AttributesTest extends TestCase
'attribute'
=>
'value'
,
];
$expected
=
'attribute'
;
$this
->
expectException
(
\InvalidArgumen
tException
::
class
,
$this
->
expectException
(
InvalidArgumentException
::
class
);
$this
->
expec
tException
Message
(
'The attributes array is not normalized, values should be arrays.'
);
Attributes
::
getExpectedAttribute
(
$attributes
,
$expected
);
...
...
@@ -76,10 +77,8 @@ class AttributesTest extends TestCase
'attribute'
=>
[
'value'
],
];
$expected
=
'missing'
;
$this
->
expectException
(
\SimpleSAML\Error\Exception
::
class
,
"No such attribute '"
.
$expected
.
"' found."
);
$this
->
expectException
(
SimpleSAML\Error\Exception
::
class
);
$this
->
expectExceptionMessage
(
"No such attribute '"
.
$expected
.
"' found."
);
Attributes
::
getExpectedAttribute
(
$attributes
,
$expected
);
}
...
...
@@ -95,10 +94,8 @@ class AttributesTest extends TestCase
'attribute'
=>
[],
];
$expected
=
'attribute'
;
$this
->
expectException
(
\SimpleSAML\Error\Exception
::
class
,
"Empty attribute '"
.
$expected
.
"'.'"
);
$this
->
expectException
(
SimpleSAML\Error\Exception
::
class
);
$this
->
expectExceptionMessage
(
"Empty attribute '"
.
$expected
.
"'.'"
);
Attributes
::
getExpectedAttribute
(
$attributes
,
$expected
);
}
...
...
@@ -117,8 +114,8 @@ class AttributesTest extends TestCase
],
];
$expected
=
'attribute'
;
$this
->
expectException
(
\SimpleSAML\Error\
Exception
::
class
,
$this
->
expectException
(
SimpleSAML\Error\Exception
::
class
);
$this
->
expect
Exception
Message
(
'More than one value found for the attribute, multiple values not allowed.'
);
Attributes
::
getExpectedAttribute
(
$attributes
,
$expected
);
...
...
@@ -155,7 +152,7 @@ class AttributesTest extends TestCase
*/
public
function
testNormalizeAttributesArrayBadInput
()
{
$this
->
expectException
(
\
InvalidArgumentException
::
class
);
$this
->
expectException
(
InvalidArgumentException
::
class
);
Attributes
::
normalizeAttributesArray
(
'string'
);
}
...
...
@@ -166,7 +163,7 @@ class AttributesTest extends TestCase
*/
public
function
testNormalizeAttributesArrayBadKeys
()
{
$this
->
expectException
(
\
InvalidArgumentException
::
class
);
$this
->
expectException
(
InvalidArgumentException
::
class
);
Attributes
::
normalizeAttributesArray
([
'attr1'
=>
'value1'
,
1
=>
'value2'
]);
}
...
...
@@ -177,7 +174,7 @@ class AttributesTest extends TestCase
*/
public
function
testNormalizeAttributesArrayBadValues
()
{
$this
->
expectException
(
\
InvalidArgumentException
::
class
);
$this
->
expectException
(
InvalidArgumentException
::
class
);
Attributes
::
normalizeAttributesArray
([
'attr1'
=>
'value1'
,
'attr2'
=>
0
]);
}
...
...
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