FOSSology  4.4.0
Open Source License Compliance by Open Source Software
Fossology\UI\Api\Test\Helper\AuthHelperTest Class Reference

Test cases for AuthHelper. More...

Inheritance diagram for Fossology\UI\Api\Test\Helper\AuthHelperTest:
Inheritance graph
Collaboration diagram for Fossology\UI\Api\Test\Helper\AuthHelperTest:
Collaboration graph

Public Member Functions

 testVerifyAuthToken ()
 
 testVerifyAuthTokenInactiveUser ()
 
 testIsTokenActive ()
 
 testIsTokenActiveExpireOldToken ()
 
 testUserHasGroupAccess ()
 

Protected Member Functions

 setUp ()
 Setup test objects. More...
 
 tearDown ()
 Remove test objects. More...
 

Private Attributes

 $assertCountBefore
 
 $authHelper
 
 $userDao
 
 $session
 
 $dbHelper
 

Detailed Description

Test cases for AuthHelper.

Definition at line 32 of file AuthHelperTest.php.

Member Function Documentation

◆ setUp()

Fossology\UI\Api\Test\Helper\AuthHelperTest::setUp ( )
protected

Setup test objects.

See also
PHPUnit_Framework_TestCase::setUp()

Definition at line 69 of file AuthHelperTest.php.

◆ tearDown()

Fossology\UI\Api\Test\Helper\AuthHelperTest::tearDown ( )
protected

Remove test objects.

See also
PHPUnit_Framework_TestCase::tearDown()

Definition at line 86 of file AuthHelperTest.php.

◆ testIsTokenActive()

Fossology\UI\Api\Test\Helper\AuthHelperTest::testIsTokenActive ( )
Test:
  1. Test for AuthHelper::isTokenActive()
  2. Generate two DB rows with active and inactive tokens
  3. Call AuthHelper::isTokenActive() on both rows and check for exception

Definition at line 186 of file AuthHelperTest.php.

◆ testIsTokenActiveExpireOldToken()

Fossology\UI\Api\Test\Helper\AuthHelperTest::testIsTokenActiveExpireOldToken ( )
Test:
  1. Test for AuthHelper::isTokenActive()
  2. Generate DB row with expired token
  3. Check if AuthHelper::isTokenActive() calls DbHelper::invalidateToken()
  4. Check if the function throws exception

Definition at line 223 of file AuthHelperTest.php.

◆ testUserHasGroupAccess()

Fossology\UI\Api\Test\Helper\AuthHelperTest::testUserHasGroupAccess ( )
Test:
  1. Test for AuthHelper::userHasGroupAccess()
  2. Check if the function accepts correct group
  3. Check if the function throws exception for inaccessible group

Definition at line 251 of file AuthHelperTest.php.

◆ testVerifyAuthToken()

Fossology\UI\Api\Test\Helper\AuthHelperTest::testVerifyAuthToken ( )
Test:
  1. Test for AuthHelper::verifyAuthToken(), AuthHelper::generateJwtToken() and AuthHelper::isTokenActive()
  2. Generate a JWT token using AuthHelper::generateJwtToken()
  3. Call AuthHelper::verifyAuthToken()
  4. Check if no exception is thrown
  5. Check if the function updates user id and token scope.

Definition at line 102 of file AuthHelperTest.php.

◆ testVerifyAuthTokenInactiveUser()

Fossology\UI\Api\Test\Helper\AuthHelperTest::testVerifyAuthTokenInactiveUser ( )
Test:
  1. Test for AuthHelper::verifyAuthToken() with inactive user
  2. Generate a JWT token using AuthHelper::generateJwtToken()
  3. Call AuthHelper::verifyAuthToken()
  4. Check if the function throws exception

Definition at line 145 of file AuthHelperTest.php.

Member Data Documentation

◆ $assertCountBefore

integer Fossology\UI\Api\Test\Helper\AuthHelperTest::$assertCountBefore
private

Assertions before running tests

Definition at line 39 of file AuthHelperTest.php.

◆ $authHelper

AuthHelper Fossology\UI\Api\Test\Helper\AuthHelperTest::$authHelper
private

AuthHelper object to test

Definition at line 45 of file AuthHelperTest.php.

◆ $dbHelper

DbHelper Fossology\UI\Api\Test\Helper\AuthHelperTest::$dbHelper
private

DbHelper mock

Definition at line 63 of file AuthHelperTest.php.

◆ $session

Session Fossology\UI\Api\Test\Helper\AuthHelperTest::$session
private

Session mock

Definition at line 57 of file AuthHelperTest.php.

◆ $userDao

UserDao Fossology\UI\Api\Test\Helper\AuthHelperTest::$userDao
private

UserDao mock

Definition at line 51 of file AuthHelperTest.php.


The documentation for this class was generated from the following file: