FOSSology  4.4.0
Open Source License Compliance by Open Source Software
Fossology\UI\Api\Test\Controllers\UserControllerTest Class Reference

Test cases for UserController. More...

Inheritance diagram for Fossology\UI\Api\Test\Controllers\UserControllerTest:
Inheritance graph
Collaboration diagram for Fossology\UI\Api\Test\Controllers\UserControllerTest:
Collaboration graph

Public Member Functions

 testGetSpecificUser ()
 
 testGetSpecificUserNotFound ()
 
 testGetAllUsers ()
 
 testDeleteUser ()
 
 testDeleteUserDoesNotExists ()
 
 testGetCurrentUser ()
 

Protected Member Functions

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

Private Member Functions

 getResponseJson ($response)
 
 getUsers ($userIds)
 

Private Attributes

 $assertCountBefore
 
 $dbHelper
 
 $restHelper
 

Detailed Description

Test cases for UserController.

Definition at line 34 of file UserControllerTest.php.

Member Function Documentation

◆ getResponseJson()

Fossology\UI\Api\Test\Controllers\UserControllerTest::getResponseJson (   $response)
private

Helper function to get JSON array from response

Parameters
Response$response
Returns
array Decoded response

Definition at line 94 of file UserControllerTest.php.

◆ getUsers()

Fossology\UI\Api\Test\Controllers\UserControllerTest::getUsers (   $userIds)
private

Generate array of users

Parameters
array$userIdsUser ids to be generated
Returns
array[]

Definition at line 105 of file UserControllerTest.php.

◆ setUp()

Fossology\UI\Api\Test\Controllers\UserControllerTest::setUp ( )
protected

Setup test objects.

See also
PHPUnit_Framework_TestCase::setUp()

Definition at line 59 of file UserControllerTest.php.

◆ tearDown()

Fossology\UI\Api\Test\Controllers\UserControllerTest::tearDown ( )
protected

Remove test objects.

See also
PHPUnit_Framework_TestCase::tearDown()

Definition at line 81 of file UserControllerTest.php.

◆ testDeleteUser()

Fossology\UI\Api\Test\Controllers\UserControllerTest::testDeleteUser ( )
Test:
  1. Test UserController::deleteUser() for valid delete request
  2. Check if response status is 202

Definition at line 202 of file UserControllerTest.php.

◆ testDeleteUserDoesNotExists()

Fossology\UI\Api\Test\Controllers\UserControllerTest::testDeleteUserDoesNotExists ( )
Test:
  1. Test UserController::deleteUser() for invalid user id
  2. Check if response status is 404

Definition at line 230 of file UserControllerTest.php.

◆ testGetAllUsers()

Fossology\UI\Api\Test\Controllers\UserControllerTest::testGetAllUsers ( )
Test:
  1. Test UserController::getUsers() for all users
  2. Check if the response is list of user info

Definition at line 176 of file UserControllerTest.php.

◆ testGetCurrentUser()

Fossology\UI\Api\Test\Controllers\UserControllerTest::testGetCurrentUser ( )
Test:
  1. Test UserController::getCurrentUser()
  2. Check if response contains current user's info

Definition at line 252 of file UserControllerTest.php.

◆ testGetSpecificUser()

Fossology\UI\Api\Test\Controllers\UserControllerTest::testGetSpecificUser ( )
Test:
  1. Test UserController::getUsers() for specific user id
  2. Check if response contains only one user info

Definition at line 130 of file UserControllerTest.php.

◆ testGetSpecificUserNotFound()

Fossology\UI\Api\Test\Controllers\UserControllerTest::testGetSpecificUserNotFound ( )
Test:
  1. Test UserController::getUsers() for invalid user id
  2. Check if response status is 404

Definition at line 158 of file UserControllerTest.php.

Member Data Documentation

◆ $assertCountBefore

integer Fossology\UI\Api\Test\Controllers\UserControllerTest::$assertCountBefore
private

Assertions before running tests

Definition at line 41 of file UserControllerTest.php.

◆ $dbHelper

DbHelper Fossology\UI\Api\Test\Controllers\UserControllerTest::$dbHelper
private

DbHelper mock

Definition at line 47 of file UserControllerTest.php.

◆ $restHelper

RestHelper Fossology\UI\Api\Test\Controllers\UserControllerTest::$restHelper
private

RestHelper mock

Definition at line 53 of file UserControllerTest.php.


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