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

 testGetSpecificUserV1 ()
 
 testGetSpecificUserV2 ()
 
 testGetSpecificUserNotFoundV1 ()
 
 testGetSpecificUserNotFoundV2 ()
 
 testGetAllUsersV1 ()
 
 testGetAllUsersV2 ()
 
 testDeleteUserV1 ()
 
 testDeleteUserV2 ()
 
 testDeleteUserDoesNotExistsV1 ()
 
 testDeleteUserDoesNotExistsV2 ()
 
 testGetCurrentUserV1 ()
 
 testGetCurrentUserV2 ()
 

Protected Member Functions

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

Private Member Functions

 getResponseJson ($response)
 
 getUsers ($userIds)
 
 testGetSpecificUser ($version=ApiVersion::V2)
 
 testGetSpecificUserNotFound ($version=ApiVersion::V2)
 
 testGetAllUsers ($version=ApiVersion::V2)
 
 testDeleteUser ($version=ApiVersion::V2)
 
 testDeleteUserDoesNotExists ($version=ApiVersion::V2)
 
 testGetCurrentUser ($version=ApiVersion::V2)
 

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 (   $version = ApiVersion::V2)
private
Parameters
$versionto test
Returns
void

Definition at line 286 of file UserControllerTest.php.

◆ testDeleteUserDoesNotExists()

Fossology\UI\Api\Test\Controllers\UserControllerTest::testDeleteUserDoesNotExists (   $version = ApiVersion::V2)
private
Parameters
$version
Returns
void

Definition at line 330 of file UserControllerTest.php.

◆ testDeleteUserDoesNotExistsV1()

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

Definition at line 313 of file UserControllerTest.php.

◆ testDeleteUserDoesNotExistsV2()

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

Definition at line 322 of file UserControllerTest.php.

◆ testDeleteUserV1()

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

Definition at line 269 of file UserControllerTest.php.

◆ testDeleteUserV2()

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

Definition at line 278 of file UserControllerTest.php.

◆ testGetAllUsers()

Fossology\UI\Api\Test\Controllers\UserControllerTest::testGetAllUsers (   $version = ApiVersion::V2)
private
Parameters
$versionto test
Returns
void

Definition at line 237 of file UserControllerTest.php.

◆ testGetAllUsersV1()

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

Definition at line 220 of file UserControllerTest.php.

◆ testGetAllUsersV2()

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

Definition at line 229 of file UserControllerTest.php.

◆ testGetCurrentUser()

Fossology\UI\Api\Test\Controllers\UserControllerTest::testGetCurrentUser (   $version = ApiVersion::V2)
private
Parameters
$versionto test
Returns
void

Definition at line 368 of file UserControllerTest.php.

◆ testGetCurrentUserV1()

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

Definition at line 351 of file UserControllerTest.php.

◆ testGetCurrentUserV2()

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

Definition at line 360 of file UserControllerTest.php.

◆ testGetSpecificUser()

Fossology\UI\Api\Test\Controllers\UserControllerTest::testGetSpecificUser (   $version = ApiVersion::V2)
private
Parameters
$versionto test
Returns
void

Definition at line 147 of file UserControllerTest.php.

◆ testGetSpecificUserNotFound()

Fossology\UI\Api\Test\Controllers\UserControllerTest::testGetSpecificUserNotFound (   $version = ApiVersion::V2)
private
Parameters
$versionto test
Returns
void

Definition at line 197 of file UserControllerTest.php.

◆ testGetSpecificUserNotFoundV1()

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

Definition at line 180 of file UserControllerTest.php.

◆ testGetSpecificUserNotFoundV2()

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

Definition at line 189 of file UserControllerTest.php.

◆ testGetSpecificUserV1()

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

Definition at line 130 of file UserControllerTest.php.

◆ testGetSpecificUserV2()

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

Definition at line 139 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: