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

Test for FolderController. More...

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

Public Member Functions

 getFolder ($id)
 
 getFolderParent ($id)
 
 testGetAllFolders ()
 
 testGetAllFoldersNotFound ()
 
 testGetSpecificFolders ()
 
 testGetInvalidFolder ()
 
 testGetInAccessibleFolder ()
 
 testCreateFolderV1 ()
 
 testCreateFolderV2 ()
 
 testCreateFolderInvalidBody ()
 
 testCreateFolderParentNotAccessibleV1 ()
 
 testCreateFolderParentNotAccessibleV2 ()
 
 testCreateFolderDuplicateNamesV1 ()
 
 testCreateFolderDuplicateNamesV2 ()
 
 testDeleteFolder ()
 
 testDeleteFolderInvalidFolder ()
 
 testDeleteFolderNoAccess ()
 
 testEditFolderV1 ()
 
 testEditFolderV2 ()
 
 testEditFolderNotExistsV1 ()
 
 testEditFolderNotExistsV2 ()
 
 testEditFolderNotAccessibleV1 ()
 
 testEditFolderNotAccessibleV2 ()
 
 testCopyFolderV1 ()
 
 testCopyFolderV2 ()
 
 testMoveFolderV1 ()
 
 testMoveFolderV2 ()
 
 testCopyFolderNotFoundV1 ()
 
 testCopyFolderNotFoundV2 ()
 
 testCopyParentFolderNotFoundV1 ()
 
 testCopyParentFolderNotFoundV2 ()
 
 testCopyFolderNotAccessibleV1 ()
 
 testCopyFolderNotAccessibleV2 ()
 
 testCopyParentFolderNotAccessibleV1 ()
 
 testCopyParentFolderNotAccessibleV2 ()
 
 testCopyFolderInvalidActionV1 ()
 
 testCopyFolderInvalidActionV2 ()
 
 testUnlinkFolderFolderNotFound ()
 
 testUnlinkUnExistingFolder ()
 
 testGetAllFolderContents ()
 
 testGetAllFolderContentsNotFound ()
 
 testGetAllInAccessibleFolderContents ()
 
 testGetUnlinkableFolderContents ()
 
 testGetUnlinkableInaccessibleFolderContents ()
 
 testGetUnlinkableFolderContentsBadRequest ()
 

Protected Member Functions

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

Private Member Functions

 getResponseJson ($response)
 
 testCreateFolder ($version=ApiVersion::V2)
 
 testCreateFolderParentNotAccessible ($version=ApiVersion::V2)
 
 testCreateFolderDuplicateNames ($version=ApiVersion::V2)
 
 testEditFolder ($version=ApiVersion::V2)
 
 testEditFolderNotExists ($version=ApiVersion::V2)
 
 testEditFolderNotAccessible ($version=ApiVersion::V2)
 
 testCopyFolder ($version=ApiVersion::V2)
 
 testMoveFolder ($version=ApiVersion::V2)
 
 testCopyFolderNotFound ($version=ApiVersion::V2)
 
 testCopyParentFolderNotFound ($version=ApiVersion::V2)
 
 testCopyFolderNotAccessible ($version=ApiVersion::V2)
 
 testCopyParentFolderNotAccessible ($version=ApiVersion::V2)
 
 testCopyFolderInvalidAction ($version=ApiVersion::V2)
 

Private Attributes

 $dbHelper
 
 $folderDao
 
 $restHelper
 
 $folderController
 
 $userId
 
 $folderPlugin
 
 $deletePlugin
 
 $folderPropertiesPlugin
 
 $folderContentPlugin
 
 $assertCountBefore
 
 $streamFactory
 
 $folderContents
 
 $container
 

Detailed Description

Test for FolderController.

Definition at line 75 of file FolderControllerTest.php.

Member Function Documentation

◆ getFolder()

Fossology\UI\Api\Test\Controllers\FolderControllerTest::getFolder (   $id)

Helper function to generate pseudo Folder objects

Parameters
integer$idFolder ID to generate
Returns
NULL|\Fossology\Lib\Data\Folder\Folder

Definition at line 202 of file FolderControllerTest.php.

◆ getFolderParent()

Fossology\UI\Api\Test\Controllers\FolderControllerTest::getFolderParent (   $id)

Helper function to get pseudo parent id of given folder

Parameters
integer$idFolder id to get parent
Returns
int|NULL

Definition at line 221 of file FolderControllerTest.php.

◆ getResponseJson()

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

Helper function to get JSON array from response

Parameters
Response$response
Returns
array Decoded response

Definition at line 238 of file FolderControllerTest.php.

◆ setUp()

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

Setup test objects.

See also
PHPUnit_Framework_TestCase::setUp()

Definition at line 146 of file FolderControllerTest.php.

◆ tearDown()

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

Remove test objects.

See also
PHPUnit_Framework_TestCase::tearDown()

Definition at line 189 of file FolderControllerTest.php.

◆ testCopyFolder()

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

Definition at line 778 of file FolderControllerTest.php.

◆ testCopyFolderInvalidAction()

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

Definition at line 1099 of file FolderControllerTest.php.

◆ testCopyFolderInvalidActionV1()

Fossology\UI\Api\Test\Controllers\FolderControllerTest::testCopyFolderInvalidActionV1 ( )
Test:
  1. Test for invalid action on FolderController::copyFolder() with version 1 attributes
  2. Check for 400 response

Definition at line 1080 of file FolderControllerTest.php.

◆ testCopyFolderInvalidActionV2()

Fossology\UI\Api\Test\Controllers\FolderControllerTest::testCopyFolderInvalidActionV2 ( )
Test:
  1. Test for invalid action on FolderController::copyFolder() with version 2 attributes
  2. Check for 400 response

Definition at line 1089 of file FolderControllerTest.php.

◆ testCopyFolderNotAccessible()

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

Definition at line 1001 of file FolderControllerTest.php.

◆ testCopyFolderNotAccessibleV1()

Fossology\UI\Api\Test\Controllers\FolderControllerTest::testCopyFolderNotAccessibleV1 ( )
Test:
  1. Test for inaccessible folder on FolderController::copyFolder() with version 1 attributes
  2. Check for 403 response

Definition at line 983 of file FolderControllerTest.php.

◆ testCopyFolderNotAccessibleV2()

Fossology\UI\Api\Test\Controllers\FolderControllerTest::testCopyFolderNotAccessibleV2 ( )
Test:
  1. Test for inaccessible folder on FolderController::copyFolder() with version 2 attributes
  2. Check for 403 response

Definition at line 992 of file FolderControllerTest.php.

◆ testCopyFolderNotFoundV1()

Fossology\UI\Api\Test\Controllers\FolderControllerTest::testCopyFolderNotFoundV1 ( )
Test:
  1. Test for invalid folder copy on FolderController::copyFolder() with version 1 attributes
  2. Check for 404 response

Definition at line 893 of file FolderControllerTest.php.

◆ testCopyFolderNotFoundV2()

Fossology\UI\Api\Test\Controllers\FolderControllerTest::testCopyFolderNotFoundV2 ( )
Test:
  1. Test for invalid folder copy on FolderController::copyFolder() with version 2 attributes
  2. Check for 404 response

Definition at line 902 of file FolderControllerTest.php.

◆ testCopyFolderV1()

Fossology\UI\Api\Test\Controllers\FolderControllerTest::testCopyFolderV1 ( )
Test:
  1. Test for copy action on FolderController::copyFolder() with version 1 attributes
  2. Check for 202 response

Definition at line 761 of file FolderControllerTest.php.

◆ testCopyFolderV2()

Fossology\UI\Api\Test\Controllers\FolderControllerTest::testCopyFolderV2 ( )
Test:
  1. Test for copy action on FolderController::copyFolder() with version 2 attributes
  2. Check for 202 response

Definition at line 770 of file FolderControllerTest.php.

◆ testCopyParentFolderNotAccessibleV1()

Fossology\UI\Api\Test\Controllers\FolderControllerTest::testCopyParentFolderNotAccessibleV1 ( )
Test:
  1. Test for inaccessible parent folder on FolderController::copyFolder() with version 1 attributes
  2. Check for 403 response

Definition at line 1033 of file FolderControllerTest.php.

◆ testCopyParentFolderNotAccessibleV2()

Fossology\UI\Api\Test\Controllers\FolderControllerTest::testCopyParentFolderNotAccessibleV2 ( )
Test:
  1. Test for inaccessible parent folder on FolderController::copyFolder() with version 2 attributes
  2. Check for 403 response

Definition at line 1042 of file FolderControllerTest.php.

◆ testCopyParentFolderNotFoundV1()

Fossology\UI\Api\Test\Controllers\FolderControllerTest::testCopyParentFolderNotFoundV1 ( )
Test:
  1. Test for invalid parent copy on FolderController::copyFolder() with version 1 attributes
  2. Check for 404 response

Definition at line 936 of file FolderControllerTest.php.

◆ testCopyParentFolderNotFoundV2()

Fossology\UI\Api\Test\Controllers\FolderControllerTest::testCopyParentFolderNotFoundV2 ( )
Test:
  1. Test for invalid parent copy on FolderController::copyFolder() with version 2 attributes
  2. Check for 404 response

Definition at line 945 of file FolderControllerTest.php.

◆ testCreateFolder()

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

Definition at line 385 of file FolderControllerTest.php.

◆ testCreateFolderDuplicateNames()

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

Definition at line 510 of file FolderControllerTest.php.

◆ testCreateFolderDuplicateNamesV1()

Fossology\UI\Api\Test\Controllers\FolderControllerTest::testCreateFolderDuplicateNamesV1 ( )
Test:
FolderController::createFolder() with version 1 attributes
  1. Check for duplicate folder response from FolderController::createFolder()
  2. Check for 200 response

Definition at line 492 of file FolderControllerTest.php.

◆ testCreateFolderDuplicateNamesV2()

Fossology\UI\Api\Test\Controllers\FolderControllerTest::testCreateFolderDuplicateNamesV2 ( )
Test:
FolderController::createFolder() with version 2 attributes
  1. Check for duplicate folder response from FolderController::createFolder()
  2. Check for 200 response

Definition at line 502 of file FolderControllerTest.php.

◆ testCreateFolderInvalidBody()

Fossology\UI\Api\Test\Controllers\FolderControllerTest::testCreateFolderInvalidBody ( )
Test:
  1. check for Bad request exception.

Definition at line 426 of file FolderControllerTest.php.

◆ testCreateFolderParentNotAccessible()

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

Definition at line 462 of file FolderControllerTest.php.

◆ testCreateFolderParentNotAccessibleV1()

Fossology\UI\Api\Test\Controllers\FolderControllerTest::testCreateFolderParentNotAccessibleV1 ( )
Test:
  1. Check for inaccessible parent on FolderController::createFolder() with version 1 attributes
  2. Check for 403 response

Definition at line 444 of file FolderControllerTest.php.

◆ testCreateFolderParentNotAccessibleV2()

Fossology\UI\Api\Test\Controllers\FolderControllerTest::testCreateFolderParentNotAccessibleV2 ( )
Test:
  1. Check for inaccessible parent on FolderController::createFolder() with version 1 attributes
  2. Check for 403 response

Definition at line 453 of file FolderControllerTest.php.

◆ testCreateFolderV1()

Fossology\UI\Api\Test\Controllers\FolderControllerTest::testCreateFolderV1 ( )
Test:
  1. Check for FolderController::createFolder() with version 1 attributes
  2. Check for 201 response with folder id

Definition at line 367 of file FolderControllerTest.php.

◆ testCreateFolderV2()

Fossology\UI\Api\Test\Controllers\FolderControllerTest::testCreateFolderV2 ( )
Test:
  1. Check for FolderController::createFolder() with version 2 attributes
  2. Check for 201 response with folder id

Definition at line 376 of file FolderControllerTest.php.

◆ testDeleteFolder()

Fossology\UI\Api\Test\Controllers\FolderControllerTest::testDeleteFolder ( )
Test:
  1. Test for FolderController::deleteFolder()
  2. Check for 202 response

Definition at line 551 of file FolderControllerTest.php.

◆ testDeleteFolderInvalidFolder()

Fossology\UI\Api\Test\Controllers\FolderControllerTest::testDeleteFolderInvalidFolder ( )
Test:
  1. Test if folder is invalid on FolderController::deleteFolder()
  2. Check for 404 response

Definition at line 574 of file FolderControllerTest.php.

◆ testDeleteFolderNoAccess()

Fossology\UI\Api\Test\Controllers\FolderControllerTest::testDeleteFolderNoAccess ( )
Test:
  1. Test to delete inaccessible folder on FolderController::deleteFolder()
  2. Check for 403 response

Definition at line 590 of file FolderControllerTest.php.

◆ testEditFolder()

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

Definition at line 629 of file FolderControllerTest.php.

◆ testEditFolderNotAccessible()

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

Definition at line 727 of file FolderControllerTest.php.

◆ testEditFolderNotAccessibleV1()

Fossology\UI\Api\Test\Controllers\FolderControllerTest::testEditFolderNotAccessibleV1 ( )
Test:
  1. Test for inaccessible folder on FolderController::editFolder() with version 1 attributes
  2. Check for 403 response

Definition at line 710 of file FolderControllerTest.php.

◆ testEditFolderNotAccessibleV2()

Fossology\UI\Api\Test\Controllers\FolderControllerTest::testEditFolderNotAccessibleV2 ( )
Test:
  1. Test for inaccessible folder on FolderController::editFolder() with version 2 attributes
  2. Check for 403 response

Definition at line 719 of file FolderControllerTest.php.

◆ testEditFolderNotExistsV1()

Fossology\UI\Api\Test\Controllers\FolderControllerTest::testEditFolderNotExistsV1 ( )
Test:
  1. Check FolderController::editFolder() on non-existing folder with version 1 attributes
  2. Check for 404 response

Definition at line 667 of file FolderControllerTest.php.

◆ testEditFolderNotExistsV2()

Fossology\UI\Api\Test\Controllers\FolderControllerTest::testEditFolderNotExistsV2 ( )
Test:
  1. Check FolderController::editFolder() on non-existing folder with version 2 attributes
  2. Check for 404 response

Definition at line 676 of file FolderControllerTest.php.

◆ testEditFolderV1()

Fossology\UI\Api\Test\Controllers\FolderControllerTest::testEditFolderV1 ( )
Test:
  1. Test for FolderController::editFolder() with version 1 attributes
  2. Check for 200 response

Definition at line 611 of file FolderControllerTest.php.

◆ testEditFolderV2()

Fossology\UI\Api\Test\Controllers\FolderControllerTest::testEditFolderV2 ( )
Test:
  1. Test for FolderController::editFolder() with version 2 attributes
  2. Check for 200 response

Definition at line 620 of file FolderControllerTest.php.

◆ testGetAllFolderContents()

Fossology\UI\Api\Test\Controllers\FolderControllerTest::testGetAllFolderContents ( )
Test:
  1. Test for invalid action on FolderController::getAllFolderContents()
  2. Check if the statusCode is 200

Definition at line 1173 of file FolderControllerTest.php.

◆ testGetAllFolderContentsNotFound()

Fossology\UI\Api\Test\Controllers\FolderControllerTest::testGetAllFolderContentsNotFound ( )
Test:
  1. Test for invalid action on FolderController::getAllFolderContents()
  2. Check if the HttpNotFoundException is thrown

Definition at line 1192 of file FolderControllerTest.php.

◆ testGetAllFolders()

Fossology\UI\Api\Test\Controllers\FolderControllerTest::testGetAllFolders ( )
Test:
  1. Test to get all folders accessible by user by calling FolderController::getFolders()
  2. Check if the response is array of folders

Definition at line 250 of file FolderControllerTest.php.

◆ testGetAllFoldersNotFound()

Fossology\UI\Api\Test\Controllers\FolderControllerTest::testGetAllFoldersNotFound ( )
Test:
FolderController::getFolders()
  1. Check if the response is an HttpNotFoundException

Definition at line 279 of file FolderControllerTest.php.

◆ testGetAllInAccessibleFolderContents()

Fossology\UI\Api\Test\Controllers\FolderControllerTest::testGetAllInAccessibleFolderContents ( )
Test:
  1. Test for invalid action on FolderController::getAllFolderContents()
  2. Check if the HttpForbiddenException is thrown

Definition at line 1206 of file FolderControllerTest.php.

◆ testGetInAccessibleFolder()

Fossology\UI\Api\Test\Controllers\FolderControllerTest::testGetInAccessibleFolder ( )
Test:
  1. Test to check inaccessible folder's response on FolderController::getFolders()
  2. Check for 403 response

Definition at line 349 of file FolderControllerTest.php.

◆ testGetInvalidFolder()

Fossology\UI\Api\Test\Controllers\FolderControllerTest::testGetInvalidFolder ( )
Test:
  1. Test to check a 403 response of invalid folder
  2. Call FolderController::getFolders() for invalid folder
  3. Check for a 403 response

Definition at line 330 of file FolderControllerTest.php.

◆ testGetSpecificFolders()

Fossology\UI\Api\Test\Controllers\FolderControllerTest::testGetSpecificFolders ( )
Test:
  1. Test to get specific folder from FolderController::getFolders()
  2. Check if the response is a single object of Folder

Definition at line 302 of file FolderControllerTest.php.

◆ testGetUnlinkableFolderContents()

Fossology\UI\Api\Test\Controllers\FolderControllerTest::testGetUnlinkableFolderContents ( )
Test:
  1. Test for invalid action on FolderController::getUnlinkableFolderContents()
  2. Check if the statusCode is 200

Definition at line 1223 of file FolderControllerTest.php.

◆ testGetUnlinkableFolderContentsBadRequest()

Fossology\UI\Api\Test\Controllers\FolderControllerTest::testGetUnlinkableFolderContentsBadRequest ( )
Test:
  1. Test for invalid action on FolderController::getUnlinkableFolderContents()
  2. Check if the HttpNotFoundException is thrown

Definition at line 1264 of file FolderControllerTest.php.

◆ testGetUnlinkableInaccessibleFolderContents()

Fossology\UI\Api\Test\Controllers\FolderControllerTest::testGetUnlinkableInaccessibleFolderContents ( )
Test:
  1. Test for invalid action on FolderController::getUnlinkableFolderContents()
  2. Check if the HttpForbiddenException is thrown

Definition at line 1245 of file FolderControllerTest.php.

◆ testMoveFolder()

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

Definition at line 846 of file FolderControllerTest.php.

◆ testMoveFolderV1()

Fossology\UI\Api\Test\Controllers\FolderControllerTest::testMoveFolderV1 ( )
Test:
  1. Test for move action on FolderController::copyFolder() with version 1 attributes
  2. Check for 202 response

Definition at line 828 of file FolderControllerTest.php.

◆ testMoveFolderV2()

Fossology\UI\Api\Test\Controllers\FolderControllerTest::testMoveFolderV2 ( )
Test:
  1. Test for move action on FolderController::copyFolder() with version 2 attributes
  2. Check for 202 response

Definition at line 837 of file FolderControllerTest.php.

◆ testUnlinkFolderFolderNotFound()

Fossology\UI\Api\Test\Controllers\FolderControllerTest::testUnlinkFolderFolderNotFound ( )
Test:
  1. Test for invalid action on FolderController::unlinkFolder()
  2. Check if the HttpNotFoundException is thrown

Definition at line 1137 of file FolderControllerTest.php.

◆ testUnlinkUnExistingFolder()

Fossology\UI\Api\Test\Controllers\FolderControllerTest::testUnlinkUnExistingFolder ( )
Test:
  1. Test for invalid action on FolderController::unlinkFolder()
  2. Check if the HttpNotFoundException is thrown

Definition at line 1155 of file FolderControllerTest.php.

Member Data Documentation

◆ $assertCountBefore

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

Assertions before running tests

Definition at line 128 of file FolderControllerTest.php.

◆ $dbHelper

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

DbHelper mock

Definition at line 82 of file FolderControllerTest.php.

◆ $deletePlugin

admin_folder_delete Fossology\UI\Api\Test\Controllers\FolderControllerTest::$deletePlugin
private

Delagent folder delete object to mock

Definition at line 112 of file FolderControllerTest.php.

◆ $folderContentPlugin

AdminContentMove Fossology\UI\Api\Test\Controllers\FolderControllerTest::$folderContentPlugin
private

Folder copy/move plugin object to mock

Definition at line 122 of file FolderControllerTest.php.

◆ $folderController

FolderController Fossology\UI\Api\Test\Controllers\FolderControllerTest::$folderController
private

FolderController object to test

Definition at line 97 of file FolderControllerTest.php.

◆ $folderDao

FolderDao Fossology\UI\Api\Test\Controllers\FolderControllerTest::$folderDao
private

FolderDao mock

Definition at line 87 of file FolderControllerTest.php.

◆ $folderPlugin

folder_create Fossology\UI\Api\Test\Controllers\FolderControllerTest::$folderPlugin
private

Folder plugin object to mock

Definition at line 107 of file FolderControllerTest.php.

◆ $folderPropertiesPlugin

folder_properties Fossology\UI\Api\Test\Controllers\FolderControllerTest::$folderPropertiesPlugin
private

Folder properties plugin to mock

Definition at line 117 of file FolderControllerTest.php.

◆ $restHelper

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

RestHelper mock

Definition at line 92 of file FolderControllerTest.php.

◆ $streamFactory

StreamFactory Fossology\UI\Api\Test\Controllers\FolderControllerTest::$streamFactory
private

Stream factory to create body streams.

Definition at line 135 of file FolderControllerTest.php.

◆ $userId

integer Fossology\UI\Api\Test\Controllers\FolderControllerTest::$userId
private

Current user ID to test

Definition at line 102 of file FolderControllerTest.php.


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