FOSSology  4.7.1
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 ()
 
 testAddUserEmptyBody ()
 
 testAddUserMissingName ()
 

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 36 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 98 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 109 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 61 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 84 of file UserControllerTest.php.

◆ testAddUserEmptyBody()

Fossology\UI\Api\Test\Controllers\UserControllerTest::testAddUserEmptyBody ( )
Test:
  1. Test UserController::addUser() with empty request body
  2. Check if HttpBadRequestException is thrown

Definition at line 403 of file UserControllerTest.php.

◆ testAddUserMissingName()

Fossology\UI\Api\Test\Controllers\UserControllerTest::testAddUserMissingName ( )
Test:
  1. Test UserController::addUser() with missing username
  2. Check if HttpBadRequestException is thrown

Definition at line 422 of file UserControllerTest.php.

◆ testDeleteUser()

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

Definition at line 290 of file UserControllerTest.php.

◆ testDeleteUserDoesNotExists()

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

Definition at line 334 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 317 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 326 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 273 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 282 of file UserControllerTest.php.

◆ testGetAllUsers()

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

Definition at line 241 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 224 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 233 of file UserControllerTest.php.

◆ testGetCurrentUser()

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

Definition at line 372 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 355 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 364 of file UserControllerTest.php.

◆ testGetSpecificUser()

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

Definition at line 151 of file UserControllerTest.php.

◆ testGetSpecificUserNotFound()

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

Definition at line 201 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 184 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 193 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 134 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 143 of file UserControllerTest.php.

Member Data Documentation

◆ $assertCountBefore

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

Assertions before running tests

Definition at line 43 of file UserControllerTest.php.

◆ $dbHelper

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

DbHelper mock

Definition at line 49 of file UserControllerTest.php.

◆ $restHelper

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

RestHelper mock

Definition at line 55 of file UserControllerTest.php.


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