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

 testDeleteGroupV1 ()
 
 testDeleteGroupV2 ()
 
 testGetDeletableGroupsV1 ()
 
 testGetDeletableGroupsV2 ()
 
 testGetGroupMembersV2 ()
 
 testGetGroupMembersV1 ()
 
 testAddMemberUserNotMemberV1 ()
 
 testAddMemberUserNotMemberV2 ()
 
 testAddMemberUserNotMember ($version=ApiVersion::V2)
 
 testAddMemberUserNotAdminV2 ()
 
 testAddMemberUserNotAdminV1 ()
 
 testAddMemberUserGroupAdminV1 ()
 
 testAddMemberUserGroupAdminV2 ()
 
 testAddMemberUserAlreadyMemberV2 ()
 
 testAddMemberUserAlreadyMemberV1 ()
 
 testChangeUserPermissionV2 ()
 
 testChangeUserPermissionV1 ()
 

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)
 
 testDeleteGroup ($version=ApiVersion::V2)
 
 testGetDeletableGroups ($version=ApiVersion::V2)
 
 testGetGroupMembers ($version=ApiVersion::V2)
 
 testAddMemberUserNotAdmin ($version=ApiVersion::V2)
 
 testAddMemberUserGroupAdmin ($version=ApiVersion::V2)
 
 testAddMemberUserAlreadyMember ($version=ApiVersion::V2)
 
 testChangeUserPermission ($version=ApiVersion::V2)
 

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

Definition at line 535 of file GroupControllerTest.php.

◆ testAddMemberUserAlreadyMemberV1()

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

Definition at line 526 of file GroupControllerTest.php.

◆ testAddMemberUserAlreadyMemberV2()

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

Definition at line 514 of file GroupControllerTest.php.

◆ testAddMemberUserGroupAdminV1()

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

Definition at line 452 of file GroupControllerTest.php.

◆ testAddMemberUserGroupAdminV2()

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

Definition at line 462 of file GroupControllerTest.php.

◆ testAddMemberUserNotAdmin()

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

Definition at line 413 of file GroupControllerTest.php.

◆ testAddMemberUserNotAdminV1()

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

Definition at line 405 of file GroupControllerTest.php.

◆ testAddMemberUserNotAdminV2()

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

Definition at line 395 of file GroupControllerTest.php.

◆ testAddMemberUserNotMember()

Fossology\UI\Api\Test\Controllers\GroupControllerTest::testAddMemberUserNotMember (   $version = ApiVersion::V2)
Parameters
$versionto test
Returns
void

Definition at line 350 of file GroupControllerTest.php.

◆ testAddMemberUserNotMemberV1()

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

Definition at line 330 of file GroupControllerTest.php.

◆ testAddMemberUserNotMemberV2()

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

Definition at line 342 of file GroupControllerTest.php.

◆ testChangeUserPermission()

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

Definition at line 591 of file GroupControllerTest.php.

◆ testChangeUserPermissionV1()

Fossology\UI\Api\Test\Controllers\GroupControllerTest::testChangeUserPermissionV1 ( )
Test:
  1. Test GroupController::changeUserPermission() in version 1
  2. Check if the response is list of group members

Definition at line 583 of file GroupControllerTest.php.

◆ testChangeUserPermissionV2()

Fossology\UI\Api\Test\Controllers\GroupControllerTest::testChangeUserPermissionV2 ( )
Test:
  1. Test GroupController::changeUserPermission() in version 2
  2. Check if the response is list of group members

Definition at line 574 of file GroupControllerTest.php.

◆ testDeleteGroup()

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

Definition at line 194 of file GroupControllerTest.php.

◆ testDeleteGroupV1()

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

Definition at line 177 of file GroupControllerTest.php.

◆ testDeleteGroupV2()

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

Definition at line 186 of file GroupControllerTest.php.

◆ testGetDeletableGroups()

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

Definition at line 249 of file GroupControllerTest.php.

◆ testGetDeletableGroupsV1()

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

Definition at line 232 of file GroupControllerTest.php.

◆ testGetDeletableGroupsV2()

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

Definition at line 241 of file GroupControllerTest.php.

◆ testGetGroupMembers()

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

Definition at line 284 of file GroupControllerTest.php.

◆ testGetGroupMembersV1()

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

Definition at line 276 of file GroupControllerTest.php.

◆ testGetGroupMembersV2()

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

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