Skip to content

Commit 9285cde

Browse files
committed
add tests for empty and unset shib attributes
1 parent 9cdf8e1 commit 9285cde

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

test/unit/UnitySSOTest.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace UnityWebPortal\lib;
44

5+
use UnityWebPortal\lib\exceptions\SSOException;
56
use PHPUnit\Framework\TestCase;
67

78
class UnitySSOTest extends TestCase
@@ -22,4 +23,28 @@ public function testMultipleAttributeValues()
2223
$_PREVIOUS_SERVER = $_SERVER;
2324
}
2425
}
26+
27+
public function testUnsetAttribute()
28+
{
29+
$PREVIOUS_SERVER = $_SERVER;
30+
$this->expectException(SSOException::class);
31+
try {
32+
unset($_SERVER["REMOTE_USER"]);
33+
$sso = UnitySSO::getSSO();
34+
} finally {
35+
$_PREVIOUS_SERVER = $_SERVER;
36+
}
37+
}
38+
39+
public function testEmptyAttribute()
40+
{
41+
$PREVIOUS_SERVER = $_SERVER;
42+
$this->expectException(SSOException::class);
43+
try {
44+
$_SERVER["REMOTE_USER"] = "";
45+
$sso = UnitySSO::getSSO();
46+
} finally {
47+
$_PREVIOUS_SERVER = $_SERVER;
48+
}
49+
}
2550
}

0 commit comments

Comments
 (0)