FOSSology  4.4.0
Open Source License Compliance by Open Source Software
UserInfoTest.php
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2014 Siemens AG
4 
5  SPDX-License-Identifier: GPL-2.0-only
6 */
7 
9 
14 class UserInfoTest extends \PHPUnit\Framework\TestCase
15 {
16 
19  private $userInfo;
20 
25  protected function setUp() : void
26  {
27  $this->userInfo = new UserInfo();
28  }
29 
36  public function testGetUserId()
37  {
38  $userId = 424;
39 
40  $_SESSION['UserId'] = $userId;
41 
42  assertThat($this->userInfo->getUserId(), is($userId));
43  }
44 
51  public function testGetGroupId()
52  {
53  $groupId = 321;
54 
55  $_SESSION['GroupId'] = $groupId;
56 
57  assertThat($this->userInfo->getGroupId(), is($groupId));
58  }
59 }
Unit tests for UserInfo class.
testGetUserId()
Test for UserInfo::getUserId()
setUp()
One time setup for test.
testGetGroupId()
Test for UserInfo::getGroupId()
Get user info from session.
Definition: UserInfo.php:20
Utility functions for specific applications.