FOSSology
4.7.1
Open Source License Compliance by Open Source Software
AuthTest.php
1
<?php
2
/*
3
SPDX-FileCopyrightText: © 2026 Siemens AG
4
5
SPDX-License-Identifier: GPL-2.0-only
6
*/
7
8
namespace
Fossology\Lib\Auth
;
9
14
class
AuthTest
extends
\PHPUnit\Framework\TestCase
15
{
16
protected
function
setUp():
void
17
{
18
$_SESSION = array();
19
}
20
21
protected
function
tearDown():
void
22
{
23
$_SESSION = array();
24
}
25
32
public
function
testIsAdminFalseWhenSessionEmpty
(): void
33
{
34
$this->assertFalse(
Auth::isAdmin
());
35
}
36
41
public
function
testIsAdminFalseWhenUserLevelBelowAdmin
(): void
42
{
43
$_SESSION[
Auth::USER_LEVEL
] =
Auth::PERM_ADMIN
- 1;
44
$this->assertFalse(
Auth::isAdmin
());
45
}
46
52
public
function
testIsAdminTrueWhenUserLevelIsAdmin
(): void
53
{
54
$_SESSION[
Auth::USER_LEVEL
] =
Auth::PERM_ADMIN
;
55
$this->assertTrue(
Auth::isAdmin
());
56
}
57
}
Fossology\Lib\Auth\AuthTest
Test for class Auth.
Definition:
AuthTest.php:15
Fossology\Lib\Auth\AuthTest\testIsAdminFalseWhenSessionEmpty
testIsAdminFalseWhenSessionEmpty()
Definition:
AuthTest.php:32
Fossology\Lib\Auth\AuthTest\testIsAdminFalseWhenUserLevelBelowAdmin
testIsAdminFalseWhenUserLevelBelowAdmin()
Definition:
AuthTest.php:41
Fossology\Lib\Auth\AuthTest\testIsAdminTrueWhenUserLevelIsAdmin
testIsAdminTrueWhenUserLevelIsAdmin()
Definition:
AuthTest.php:52
Fossology\Lib\Auth\Auth\isAdmin
static isAdmin()
Check if user is admin.
Definition:
Auth.php:92
Fossology\Lib\Auth\Auth\PERM_ADMIN
const PERM_ADMIN
Definition:
Auth.php:52
Fossology\Lib\Auth\Auth\USER_LEVEL
const USER_LEVEL
Definition:
Auth.php:36
Fossology\Lib\Auth
src
lib
php
Auth
test
AuthTest.php
Generated on Fri Aug 28 2026 05:17:08 for FOSSology by
1.9.1