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

Tests for GroupController. More...

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

Public Member Functions

 testDeleteGroup ()
 
 testGetDeletableGroups ()
 
 testGetGroupMembers ()
 
 testAddMemberUserNotMember ()
 
 testAddMemberUserNotAdmin ()
 
 testAddMemberUserGroupAdmin ()
 
 testAddMemberUserAlreadyMember ()
 
 testChangeUserPermission ()
 

Public Attributes

const YAML_LOC = __DIR__ . '/../../../ui/api/documentation/openapi.yaml'
 

Protected Member Functions

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

Private Member Functions

 getResponseJson ($response)
 
 getGroupMembers ($userIds)
 
 getUsersWithGroup ($userIds)
 

Private Attributes

 $assertCountBefore
 
 $dbHelper
 
 $restHelper
 
 $adminPlugin
 

Detailed Description

Tests for GroupController.

Definition at line 42 of file GroupControllerTest.php.

Member Function Documentation

◆ getGroupMembers()

Fossology\UI\Api\Test\Controllers\GroupControllerTest::getGroupMembers (   $userIds)
private

Generate array of group-members

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

Definition at line 133 of file GroupControllerTest.php.

◆ getResponseJson()

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

Helper function to get JSON array from response

Parameters
Response$response
Returns
array Decoded response

Definition at line 122 of file GroupControllerTest.php.

◆ getUsersWithGroup()

Fossology\UI\Api\Test\Controllers\GroupControllerTest::getUsersWithGroup (   $userIds)
private

Generate array of users-with-group

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

Definition at line 153 of file GroupControllerTest.php.

◆ setUp()

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

Setup test objects.

See also
PHPUnit_Framework_TestCase::setUp()

Definition at line 79 of file GroupControllerTest.php.

◆ tearDown()

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

Remove test objects.

See also
PHPUnit_Framework_TestCase::tearDown()

Definition at line 109 of file GroupControllerTest.php.

◆ testAddMemberUserAlreadyMember()

Fossology\UI\Api\Test\Controllers\GroupControllerTest::testAddMemberUserAlreadyMember ( )
Test:
  1. Test GroupController::addMember()
  2. The user already a member
  3. Test if the response body matches
  4. Test if the response status is 400

Definition at line 400 of file GroupControllerTest.php.

◆ testAddMemberUserGroupAdmin()

Fossology\UI\Api\Test\Controllers\GroupControllerTest::testAddMemberUserGroupAdmin ( )
Test:
  1. Test GroupController::addMember()
  2. The user is not an admin but group admin
  3. Test if the response status is 200

Definition at line 352 of file GroupControllerTest.php.

◆ testAddMemberUserNotAdmin()

Fossology\UI\Api\Test\Controllers\GroupControllerTest::testAddMemberUserNotAdmin ( )
Test:
  1. Test GroupController::addMember()
  2. The user is not an admin
  3. Test if the response status is 403

Definition at line 314 of file GroupControllerTest.php.

◆ testAddMemberUserNotMember()

Fossology\UI\Api\Test\Controllers\GroupControllerTest::testAddMemberUserNotMember ( )
Test:
  1. Test GroupController::addMember()
  2. The user already a member
  3. Test if the response body matches
  4. Test if the response status is 200

Definition at line 269 of file GroupControllerTest.php.

◆ testChangeUserPermission()

Fossology\UI\Api\Test\Controllers\GroupControllerTest::testChangeUserPermission ( )
Test:
  1. Test GroupController::getGroupMembers() for all groups
  2. Check if the response is list of group members

Definition at line 437 of file GroupControllerTest.php.

◆ testDeleteGroup()

Fossology\UI\Api\Test\Controllers\GroupControllerTest::testDeleteGroup ( )
Test:
  1. Test GroupController::deleteGroup() for valid delete request
  2. Check if response status is 202

Definition at line 180 of file GroupControllerTest.php.

◆ testGetDeletableGroups()

Fossology\UI\Api\Test\Controllers\GroupControllerTest::testGetDeletableGroups ( )
Test:
  1. Test GroupController::getDeletableGroups()
  2. Check if the response is a list of groups.

Definition at line 212 of file GroupControllerTest.php.

◆ testGetGroupMembers()

Fossology\UI\Api\Test\Controllers\GroupControllerTest::testGetGroupMembers ( )
Test:
  1. Test GroupController::getGroupMembers() for all groups
  2. Check if the response is list of group members

Definition at line 230 of file GroupControllerTest.php.

Member Data Documentation

◆ $adminPlugin

M MockInterface Fossology\UI\Api\Test\Controllers\GroupControllerTest::$adminPlugin
private

AdminGroupUsersPlugin mock

Definition at line 73 of file GroupControllerTest.php.

◆ $assertCountBefore

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

Assertions before running tests

Definition at line 55 of file GroupControllerTest.php.

◆ $dbHelper

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

DbHelper mock

Definition at line 61 of file GroupControllerTest.php.

◆ $restHelper

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

RestHelper mock

Definition at line 67 of file GroupControllerTest.php.

◆ YAML_LOC

string Fossology\UI\Api\Test\Controllers\GroupControllerTest::YAML_LOC = __DIR__ . '/../../../ui/api/documentation/openapi.yaml'

Location of openapi.yaml file

Definition at line 49 of file GroupControllerTest.php.


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