Skip to content

Commit 858a951

Browse files
committed
fix test, move from functional to unit
1 parent bdff0d2 commit 858a951

File tree

3 files changed

+42
-22
lines changed

3 files changed

+42
-22
lines changed

test/functional/MultipleAttributeValueTest.php

Lines changed: 0 additions & 22 deletions
This file was deleted.

test/phpunit-bootstrap.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,23 @@ function getNonExistentUserAndExpectedUIDGIDWithCustomMapping()
196196
return [["[email protected]", "foo", "bar", "[email protected]"], 555];
197197
}
198198

199+
function getMultipleValueAttributesAndExpectedSSO()
200+
{
201+
return [
202+
[
203+
"REMOTE_USER" => "[email protected]",
204+
"givenName" => "foo;foo",
205+
"sn" => "bar;bar",
206+
207+
],
208+
[
209+
"firstname" => "foo",
210+
"lastname" => "bar",
211+
"mail" => "[email protected]",
212+
]
213+
];
214+
}
215+
199216
function getAdminUser()
200217
{
201218
return ["[email protected]", "foo", "bar", "[email protected]"];

test/unit/UnitySSOTest.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
namespace UnityWebPortal\lib;
4+
5+
use PHPUnit\Framework\TestCase;
6+
7+
class UnitySSOTest extends TestCase
8+
{
9+
public function testMultipleAttributeValues()
10+
{
11+
$PREVIOUS_SERVER = $_SERVER;
12+
$two_vars = getMultipleValueAttributesAndExpectedSSO();
13+
$attributes = $two_vars[0];
14+
$expectedSSO = $two_vars[1];
15+
try {
16+
$_SERVER = array_merge($_SERVER, $attributes);
17+
$sso = UnitySSO::getSSO();
18+
$this->assertEquals($expectedSSO["firstname"], $sso["firstname"]);
19+
$this->assertEquals($expectedSSO["lastname"], $sso["lastname"]);
20+
$this->assertEquals($expectedSSO["mail"], $sso["mail"]);
21+
} finally {
22+
$_PREVIOUS_SERVER = $_SERVER;
23+
}
24+
}
25+
}

0 commit comments

Comments
 (0)