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 ()
 

Public Attributes

 $userController
 
 $userDao
 

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 101 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 112 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 64 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 87 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 406 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 425 of file UserControllerTest.php.

◆ testDeleteUser()

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

Definition at line 293 of file UserControllerTest.php.

◆ testDeleteUserDoesNotExists()

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

Definition at line 337 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 320 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 329 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 276 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 285 of file UserControllerTest.php.

◆ testGetAllUsers()

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

Definition at line 244 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 227 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 236 of file UserControllerTest.php.

◆ testGetCurrentUser()

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

Definition at line 375 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 358 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 367 of file UserControllerTest.php.

◆ testGetSpecificUser()

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

Definition at line 154 of file UserControllerTest.php.

◆ testGetSpecificUserNotFound()

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

Definition at line 204 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 187 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 196 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 137 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 146 of file UserControllerTest.php.

Member Data Documentation

◆ $assertCountBefore

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

Assertions before running tests

Definition at line 46 of file UserControllerTest.php.

◆ $dbHelper

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

DbHelper mock

Definition at line 52 of file UserControllerTest.php.

◆ $restHelper

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

RestHelper mock

Definition at line 58 of file UserControllerTest.php.


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