We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7b6a731 commit 71a8246Copy full SHA for 71a8246
test/functional/ViewAsUserTest.php
@@ -61,4 +61,23 @@ public function testViewAsSelf()
61
{
62
$this->_testViewAsUser(getAdminUser(), getAdminUser());
63
}
64
+
65
+ public function testNonAdminViewAsAdmin()
66
+ {
67
+ global $USER;
68
+ switchUser(...getAdminUser());
69
+ $adminUid = $USER->getUID();
70
+ $this->assertTrue($USER->isAdmin());
71
+ switchUser(...getNormalUser());
72
+ try {
73
+ http_post(
74
+ __DIR__ . "/../../webroot/admin/user-mgmt.php",
75
+ [
76
+ "form_name" => "viewAsUser",
77
+ "uid" => $adminUid,
78
+ ],
79
+ );
80
+ } catch (PhpUnitNoDieException) {}
81
+ $this->assertArrayNotHasKey("viewUser", $_SESSION);
82
+ }
83
0 commit comments