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

Unit tests for LicenseController. More...

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

Public Member Functions

 testGetLicense ()
 
 testGetLicenseObligations ()
 
 testGetLicenseNotFound ()
 
 testGetAllLicenseV1 ()
 
 testGetAllLicenseV2 ()
 
 testGetAllLicenseBoundsV1 ()
 
 testGetAllLicenseBoundsV2 ()
 
 testGetAllLicenseFiltersV1 ()
 
 testGetAllLicenseFiltersV2 ()
 
 testCreateLicense ()
 
 testCreateLicenseNoShort ()
 
 testCreateLicenseNoAdmin ()
 
 testCreateDuplicateLicenseV1 ()
 
 testCreateDuplicateLicenseV2 ()
 
 testUpdateLicenseV1 ()
 
 testUpdateLicenseV2 ()
 
 testUpdateLicenseNonAdvisorV1 ()
 
 testUpdateLicenseNonAdvisorV2 ()
 
 testUpdateLicenseNonAdminV1 ()
 
 testUpdateLicenseNonAdminV2 ()
 
 testImportLicenseV1 ()
 
 testImportLicenseV2 ()
 
 testDeleteAdminLicenseCandidateIsAdmin ()
 
 testDeleteAdminLicenseCandidateNotAdmin ()
 
 testDeleteAdminLicenseCandidateNotFound ()
 
 testGetAllAdminAcknowledgements ()
 
 testGetAllAdminAcknowledgementsNotAdmin ()
 
 testHandleAdminLicenseAcknowledgementBadRequest ()
 
 testHandleAdminLicenseAcknowledgementInvalidBody ()
 
 testHandleAdminLicenseAcknowledgementWithUpdate ()
 
 testHandleAdminLicenseAcknowledgementLicenseExists ()
 
 testHandleAdminLicenseAcknowledgementCreateNew ()
 
 testHandleAdminLicenseAcknowledgementWithNoPermission ()
 
 testGetAllLicenseStandardComments ()
 
 testHandleLicenseStandardComment ()
 
 testHandleLicenseStandardCommentWithInvalidBody ()
 
 getDummyVars ()
 
 testHandleLicenseStandardCommentWithUpdate ()
 
 testHandleLicenseStandardCommentExists ()
 
 testHandleLicenseStandardCommentCreateNew ()
 
 testHandleLicenseStandardCommentNoPermission ()
 
 testExportAdminLicenseToCSV ()
 
 testExportAdminLicenseToCSVNotAdmin ()
 
 getEmptyRequest ($method)
 
 getRequestWithBody ($method, $body)
 
 testVerifyLicenseNotAdmin ()
 
 testVerifyLicenseWithBadRequest ()
 
 testVerifyLicenseWithNonUniqueName ()
 
 testVerifyNotFoundLicense ()
 
 testVerifyLicense ()
 
 getLicenseArgs ()
 
 testMergeLicenseNotAdmin ()
 
 testMergeLicenseWithBadRequest ()
 
 testMergeLicenseWithSameName ()
 
 testMergeNotFoundLicense ()
 
 testMergeLicenseWithNoCandidateLicense ()
 
 testMergeLicenseInternalServerError ()
 
 testMergeLicense ()
 
 testGetSuggestedLicensesNotAdmin ()
 
 testGetSuggestedLicenseWithBadRequest ()
 
 testGetCandidatesV1 ()
 
 testGetCandidatesV2 ()
 
 testGetCandidatesNoAdminV1 ()
 
 testGetCandidatesNoAdminV2 ()
 

Protected Member Functions

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

Private Member Functions

 getResponseJson ($response)
 
 getObligation ($id)
 
 getDaoObligation ($id)
 
 getLicense ($shortname, $obligations=false, $emptyObligation=true)
 
 getDaoLicense ($shortname)
 
 translateLicenseToDb ($licenses)
 
 testGetAllLicense ($version=ApiVersion::V2)
 
 testGetAllLicenseBounds ($version=ApiVersion::V2)
 
 testGetAllLicenseFilters ($version=ApiVersion::V2)
 
 testCreateDuplicateLicense ($version=ApiVersion::V2)
 
 testUpdateLicense ($version=ApiVersion::V2)
 
 testUpdateLicenseNonAdvisor ($version=ApiVersion::V2)
 
 testUpdateLicenseNonAdmin ($version=ApiVersion::V2)
 
 testImportLicense ($version=ApiVersion::V2)
 
 testGetCandidates ($version=ApiVersion::V2)
 
 testGetCandidatesNoAdmin ($version=ApiVersion::V2)
 

Private Attributes

 $assertCountBefore
 
 $userId
 
 $groupId
 
 $dbHelper
 
 $dbManager
 
 $restHelper
 
 $licenseController
 
 $licenseDao
 
 $userDao
 
 $adminLicenseAckDao
 
 $licenseStdCommentDao
 
 $adminLicensePlugin
 
 $streamFactory
 
 $licenseCandidatePlugin
 
 $auth
 

Detailed Description

Unit tests for LicenseController.

Definition at line 46 of file LicenseControllerTest.php.

Member Function Documentation

◆ getDaoLicense()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::getDaoLicense (   $shortname)
private

Helper function to generate licenses from LicenseDao

Parameters
string$shortname
Returns
\Fossology\Lib\Data\License

Definition at line 277 of file LicenseControllerTest.php.

◆ getDaoObligation()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::getDaoObligation (   $id)
private

Helper function to generate obligations for License Dao

Parameters
integer$id
Returns
Obligation

Definition at line 224 of file LicenseControllerTest.php.

◆ getDummyVars()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::getDummyVars ( )
  • # Function helping to store more data and provide a single point of access without repeating ourselves.
    Returns
    array

Definition at line 1417 of file LicenseControllerTest.php.

◆ getEmptyRequest()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::getEmptyRequest (   $method)

\

Test:
Returns
Request

Definition at line 1662 of file LicenseControllerTest.php.

◆ getLicense()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::getLicense (   $shortname,
  $obligations = false,
  $emptyObligation = true 
)
private

Helper function to generate licenses

Parameters
string$shortname
boolean$obligations
boolean$emptyObligation
Returns
License

Definition at line 246 of file LicenseControllerTest.php.

◆ getLicenseArgs()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::getLicenseArgs ( )
Returns
License[]

Definition at line 1835 of file LicenseControllerTest.php.

◆ getObligation()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::getObligation (   $id)
private

Helper function to generate obligations

Parameters
integer$id
Returns
Obligation

Definition at line 213 of file LicenseControllerTest.php.

◆ getRequestWithBody()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::getRequestWithBody (   $method,
  $body 
)
Returns
Request

Definition at line 1674 of file LicenseControllerTest.php.

◆ getResponseJson()

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

Helper function to get JSON array from response

Parameters
Response$response
Returns
array Decoded response

Definition at line 202 of file LicenseControllerTest.php.

◆ setUp()

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

Setup test objects.

See also
PHPUnit_Framework_TestCase::setUp()

Definition at line 143 of file LicenseControllerTest.php.

◆ tearDown()

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

Remove test objects.

See also
PHPUnit_Framework_TestCase::tearDown()

Definition at line 189 of file LicenseControllerTest.php.

◆ testCreateDuplicateLicense()

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

Definition at line 711 of file LicenseControllerTest.php.

◆ testCreateDuplicateLicenseV1()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testCreateDuplicateLicenseV1 ( )
Test:
  1. Test for LicenseController::createLicense() to create new license for version 1
  2. Simulate duplicate license name
  3. Check if response is 409

Definition at line 693 of file LicenseControllerTest.php.

◆ testCreateDuplicateLicenseV2()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testCreateDuplicateLicenseV2 ( )
Test:
  1. Test for LicenseController::createLicense() to create new license for version 2
  2. Simulate duplicate license name
  3. Check if response is 409

Definition at line 703 of file LicenseControllerTest.php.

◆ testCreateLicense()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testCreateLicense ( )
Test:
  1. Test for LicenseController::createLicense() to create new license
  2. Check if response is 201

Definition at line 585 of file LicenseControllerTest.php.

◆ testCreateLicenseNoAdmin()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testCreateLicenseNoAdmin ( )
Test:
  1. Test for LicenseController::createLicense() to create new license
  2. Non admin user can't create main license
  3. Check if response is 403

Definition at line 668 of file LicenseControllerTest.php.

◆ testCreateLicenseNoShort()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testCreateLicenseNoShort ( )
Test:
  1. Test for LicenseController::createLicense() to create new license
  2. The request body is malformed
  3. Check if response is 400

Definition at line 642 of file LicenseControllerTest.php.

◆ testDeleteAdminLicenseCandidateIsAdmin()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testDeleteAdminLicenseCandidateIsAdmin ( )
Test:
  1. Test for LicenseController::deleteAdminLicenseCandidate() to delete license-candidate.
  2. User is admin
  3. License-candidate is does exist
  4. Check if response is 200
  5. Check if response-body matches

Definition at line 994 of file LicenseControllerTest.php.

◆ testDeleteAdminLicenseCandidateNotAdmin()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testDeleteAdminLicenseCandidateNotAdmin ( )
Test:
  1. Test for LicenseController::deleteAdminLicenseCandidate() to delete license-candidate.
  2. User is not-admin
  3. License-candidate is does exist
  4. Check if response is 400
  5. Check if response-body matches

Definition at line 1018 of file LicenseControllerTest.php.

◆ testDeleteAdminLicenseCandidateNotFound()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testDeleteAdminLicenseCandidateNotFound ( )
Test:
  1. Test for LicenseController::deleteAdminLicenseCandidate() to delete license-candidate.
  2. User is admin
  3. License-candidate don't exist
  4. Check if response is 404
  5. Check if rseponse-body matches

Definition at line 1036 of file LicenseControllerTest.php.

◆ testExportAdminLicenseToCSV()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testExportAdminLicenseToCSV ( )
  1. Test for LicenseController::exportAdminLicenseToCSV() to export license to CSV.
  2. Check if the status code is 200
    Returns
    void
    Exceptions

Definition at line 1619 of file LicenseControllerTest.php.

◆ testExportAdminLicenseToCSVNotAdmin()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testExportAdminLicenseToCSVNotAdmin ( )
  1. Test for LicenseController::exportAdminLicenseToCSV() to export license to CSV.
  2. Check if the status code is 403 with HttpForbiddenException
    Returns
    void
    Exceptions

Definition at line 1648 of file LicenseControllerTest.php.

◆ testGetAllAdminAcknowledgements()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testGetAllAdminAcknowledgements ( )
Test:
Returns
void
Exceptions

Definition at line 1057 of file LicenseControllerTest.php.

◆ testGetAllAdminAcknowledgementsNotAdmin()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testGetAllAdminAcknowledgementsNotAdmin ( )
Test:
Returns
void
Exceptions

Definition at line 1118 of file LicenseControllerTest.php.

◆ testGetAllLicenseBounds()

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

Definition at line 488 of file LicenseControllerTest.php.

◆ testGetAllLicenseBoundsV1()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testGetAllLicenseBoundsV1 ( )
Test:
  1. Test for LicenseController::getAllLicenses() to fetch all licenses with version 1 params
  2. The page requested is out of bounds
  3. Check if response is 400
  4. Check if pagination headers are set

Definition at line 469 of file LicenseControllerTest.php.

◆ testGetAllLicenseBoundsV2()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testGetAllLicenseBoundsV2 ( )
Test:
  1. Test for LicenseController::getAllLicenses() to fetch all licenses with version 2 params
  2. The page requested is out of bounds
  3. Check if response is 400
  4. Check if pagination headers are set

Definition at line 480 of file LicenseControllerTest.php.

◆ testGetAllLicenseFilters()

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

Definition at line 530 of file LicenseControllerTest.php.

◆ testGetAllLicenseFiltersV1()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testGetAllLicenseFiltersV1 ( )
Test:
  1. Test for LicenseController::getAllLicenses() with kind filter for version 1
  2. Check if proper parameters are passed to DbHelper

Definition at line 513 of file LicenseControllerTest.php.

◆ testGetAllLicenseFiltersV2()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testGetAllLicenseFiltersV2 ( )
Test:
  1. Test for LicenseController::getAllLicenses() with kind filter for version 2
  2. Check if proper parameters are passed to DbHelper

Definition at line 522 of file LicenseControllerTest.php.

◆ testGetAllLicenseStandardComments()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testGetAllLicenseStandardComments ( )
Test:
Returns
void

Definition at line 1337 of file LicenseControllerTest.php.

◆ testGetAllLicenseV1()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testGetAllLicenseV1 ( )
Test:
  1. Test for LicenseController::getAllLicenses() to fetch all licenses with version 1 params
  2. Check if response is 200
  3. Check if pagination headers are set

Definition at line 405 of file LicenseControllerTest.php.

◆ testGetAllLicenseV2()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testGetAllLicenseV2 ( )
Test:
  1. Test for LicenseController::getAllLicenses() to fetch all licenses with version 2 params
  2. Check if response is 200
  3. Check if pagination headers are set

Definition at line 415 of file LicenseControllerTest.php.

◆ testGetCandidatesNoAdmin()

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

Definition at line 2183 of file LicenseControllerTest.php.

◆ testGetCandidatesNoAdminV1()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testGetCandidatesNoAdminV1 ( )
Test:
  1. Test for LicenseController::getCandidates() as a non-admin user with version 1 attributes
  2. Check if status is 403

Definition at line 2165 of file LicenseControllerTest.php.

◆ testGetCandidatesNoAdminV2()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testGetCandidatesNoAdminV2 ( )
Test:
  1. Test for LicenseController::getCandidates() as a non-admin user with version 2 attributes
  2. Check if status is 403

Definition at line 2174 of file LicenseControllerTest.php.

◆ testGetCandidatesV1()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testGetCandidatesV1 ( )
Test:
  1. Test for LicenseController::getCandidates() for version 1
  2. Check if status is 200
  3. Check if response-body matches

Definition at line 2130 of file LicenseControllerTest.php.

◆ testGetCandidatesV2()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testGetCandidatesV2 ( )
Test:
  1. Test for LicenseController::getCandidates() for version 2
  2. Check if status is 200
  3. Check if response-body matches

Definition at line 2140 of file LicenseControllerTest.php.

◆ testGetLicense()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testGetLicense ( )
Test:
  1. Test for LicenseController::getLicense() to fetch single license
  2. Check if response is 200

Definition at line 319 of file LicenseControllerTest.php.

◆ testGetLicenseNotFound()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testGetLicenseNotFound ( )
Test:
  1. Test for LicenseController::getLicense(), license not found
  2. Check if response is 404

Definition at line 382 of file LicenseControllerTest.php.

◆ testGetLicenseObligations()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testGetLicenseObligations ( )
Test:
  1. Test for LicenseController::getLicense() to fetch single license
  2. The license now has obligations
  3. Check if response is 200

Definition at line 351 of file LicenseControllerTest.php.

◆ testGetSuggestedLicensesNotAdmin()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testGetSuggestedLicensesNotAdmin ( )
Test:
Test LicenseController::getSuggestedLicense()
  • # Check is the HttpForbiddenException is thrown for unauthorized users
Returns
void
Exceptions

Definition at line 2060 of file LicenseControllerTest.php.

◆ testGetSuggestedLicenseWithBadRequest()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testGetSuggestedLicenseWithBadRequest ( )
Test:
Test LicenseController::getSuggestedLicense()
  • # Check if the status is 200
  • # Check if the actual and expected response bodies match
Returns
void
Exceptions

Definition at line 2076 of file LicenseControllerTest.php.

◆ testHandleAdminLicenseAcknowledgementBadRequest()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testHandleAdminLicenseAcknowledgementBadRequest ( )
Test:
LicenseController::handleAdminLicenseAcknowledgement
  • # Check if the status is 400
  • # Check if HttpBadRequestException is thrown with empty body
Returns
void
Exceptions

Definition at line 1139 of file LicenseControllerTest.php.

◆ testHandleAdminLicenseAcknowledgementCreateNew()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testHandleAdminLicenseAcknowledgementCreateNew ( )
Test:
Returns
void
Exceptions

Definition at line 1256 of file LicenseControllerTest.php.

◆ testHandleAdminLicenseAcknowledgementInvalidBody()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testHandleAdminLicenseAcknowledgementInvalidBody ( )
Test:
LicenseController::handleAdminLicenseAcknowledgement
  • # Check if the status is 400
  • # Check if HttpBadRequestException is thrown with invalid body
Returns
void
Exceptions

Definition at line 1160 of file LicenseControllerTest.php.

◆ testHandleAdminLicenseAcknowledgementLicenseExists()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testHandleAdminLicenseAcknowledgementLicenseExists ( )
Test:
Returns
void
Exceptions

Definition at line 1221 of file LicenseControllerTest.php.

◆ testHandleAdminLicenseAcknowledgementWithNoPermission()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testHandleAdminLicenseAcknowledgementWithNoPermission ( )
Test:
Returns
void
Exceptions

Definition at line 1296 of file LicenseControllerTest.php.

◆ testHandleAdminLicenseAcknowledgementWithUpdate()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testHandleAdminLicenseAcknowledgementWithUpdate ( )
Test:
Returns
void
Exceptions

Definition at line 1183 of file LicenseControllerTest.php.

◆ testHandleLicenseStandardComment()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testHandleLicenseStandardComment ( )
Test:
Returns
void
Exceptions

Definition at line 1376 of file LicenseControllerTest.php.

◆ testHandleLicenseStandardCommentCreateNew()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testHandleLicenseStandardCommentCreateNew ( )
Test:
Returns
void
Exceptions

Definition at line 1543 of file LicenseControllerTest.php.

◆ testHandleLicenseStandardCommentExists()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testHandleLicenseStandardCommentExists ( )
Test:
Returns
void
Exceptions

Definition at line 1513 of file LicenseControllerTest.php.

◆ testHandleLicenseStandardCommentNoPermission()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testHandleLicenseStandardCommentNoPermission ( )
Test:
Returns
void
Exceptions

Definition at line 1581 of file LicenseControllerTest.php.

◆ testHandleLicenseStandardCommentWithInvalidBody()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testHandleLicenseStandardCommentWithInvalidBody ( )
Test:
LicenseController::handleLicenseStandardComment()
  • # Check if the status is 400
  • # Check if HttpBadRequestException is thrown with invalid body
Returns
void
Exceptions

Definition at line 1399 of file LicenseControllerTest.php.

◆ testHandleLicenseStandardCommentWithUpdate()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testHandleLicenseStandardCommentWithUpdate ( )
Test:
Returns
void
Exceptions

Definition at line 1470 of file LicenseControllerTest.php.

◆ testImportLicense()

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

Definition at line 947 of file LicenseControllerTest.php.

◆ testImportLicenseV1()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testImportLicenseV1 ( )

@runInSeparateProcess @preserveGlobalState disabled

Test:
  1. Test for LicenseController::handleImportLicense() for version 1
  2. Check if response status is 200
  3. Check if response body is matches the expected response body

Definition at line 927 of file LicenseControllerTest.php.

◆ testImportLicenseV2()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testImportLicenseV2 ( )

@runInSeparateProcess @preserveGlobalState disabled

Test:
  1. Test for LicenseController::handleImportLicense() for version 2
  2. Check if response status is 200
  3. Check if response body is matches the expected response body

Definition at line 939 of file LicenseControllerTest.php.

◆ testMergeLicense()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testMergeLicense ( )
Test:
Test LicenseController::mergeLicense()
  • # Check if the status code is 200
  • # Check if expected and actual object match
Returns
void
Exceptions

Definition at line 2020 of file LicenseControllerTest.php.

◆ testMergeLicenseInternalServerError()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testMergeLicenseInternalServerError ( )
Test:
Test LicenseController::mergeLicense()
  • # Check if HttpInternalServerErrorException is thrown for duplicate license name
Returns
void
Exceptions

Definition at line 1983 of file LicenseControllerTest.php.

◆ testMergeLicenseNotAdmin()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testMergeLicenseNotAdmin ( )
Test:
Test LicenseController::mergeLicense()
  • # Check if HttpForbiddenException is thrown for unauthorized users
Returns
void
Exceptions

Definition at line 1862 of file LicenseControllerTest.php.

◆ testMergeLicenseWithBadRequest()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testMergeLicenseWithBadRequest ( )
Test:
Test LicenseController::mergeLicense()
  • # Check if the HttpBadRequestException is thrown when shortName arg is empty
Returns
void
Exceptions

Definition at line 1880 of file LicenseControllerTest.php.

◆ testMergeLicenseWithNoCandidateLicense()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testMergeLicenseWithNoCandidateLicense ( )
Test:
Test LicenseController::mergeLicense()
  • # Check if HttpNotFoundException is thrown for licenseCandidate that is not found.
  • # Check is the response status s 404
Returns
void
Exceptions

Definition at line 1953 of file LicenseControllerTest.php.

◆ testMergeLicenseWithSameName()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testMergeLicenseWithSameName ( )
Test:
Test LicenseController::mergeLicense()
  • # Check if HttpBadRequestException is thrown for license whose name is the same as it parent.
Returns
void
Exceptions

Definition at line 1902 of file LicenseControllerTest.php.

◆ testMergeNotFoundLicense()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testMergeNotFoundLicense ( )
Test:
Test LicenseController::mergeLicense()
  • # Check if HttpNotFoundException is thrown for notfound license.
Returns
void
Exceptions

Definition at line 1924 of file LicenseControllerTest.php.

◆ testUpdateLicense()

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

Definition at line 761 of file LicenseControllerTest.php.

◆ testUpdateLicenseNonAdmin()

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

Definition at line 886 of file LicenseControllerTest.php.

◆ testUpdateLicenseNonAdminV1()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testUpdateLicenseNonAdminV1 ( )
Test:
  1. Test for LicenseController::updateLicense() to edit a license for version 1
  2. User is not admin
  3. Check if response is 403

Definition at line 868 of file LicenseControllerTest.php.

◆ testUpdateLicenseNonAdminV2()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testUpdateLicenseNonAdminV2 ( )
Test:
  1. Test for LicenseController::updateLicense() to edit a license for version 2
  2. User is not admin
  3. Check if response is 403

Definition at line 878 of file LicenseControllerTest.php.

◆ testUpdateLicenseNonAdvisor()

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

Definition at line 832 of file LicenseControllerTest.php.

◆ testUpdateLicenseNonAdvisorV1()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testUpdateLicenseNonAdvisorV1 ( )
Test:
  1. Test for LicenseController::updateLicense() to edit a license for version 1
  2. User is not admin/advisor of the group
  3. Check if response is 403

Definition at line 814 of file LicenseControllerTest.php.

◆ testUpdateLicenseNonAdvisorV2()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testUpdateLicenseNonAdvisorV2 ( )
Test:
  1. Test for LicenseController::updateLicense() to edit a license for version 2
  2. User is not admin/advisor of the group
  3. Check if response is 403

Definition at line 824 of file LicenseControllerTest.php.

◆ testUpdateLicenseV1()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testUpdateLicenseV1 ( )
Test:
  1. Test for LicenseController::updateLicense() to edit a license for version 1
  2. Check if response is 200

Definition at line 744 of file LicenseControllerTest.php.

◆ testUpdateLicenseV2()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testUpdateLicenseV2 ( )
Test:
  1. Test for LicenseController::updateLicense() to edit a license for version 2
  2. Check if response is 200

Definition at line 753 of file LicenseControllerTest.php.

◆ testVerifyLicense()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testVerifyLicense ( )
Test:
  • # Test LicenseController::verifyLicense()
  • # Check if status codes match
  • # Check of expected and actual response bodies match
Returns
void
Exceptions

Definition at line 1797 of file LicenseControllerTest.php.

◆ testVerifyLicenseNotAdmin()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testVerifyLicenseNotAdmin ( )
Test:
  • # Test LicenseController::verifyLicense()
  • # Check if HttpForbiddenException is thrown for unauthorized users
Returns
void
Exceptions

Definition at line 1691 of file LicenseControllerTest.php.

◆ testVerifyLicenseWithBadRequest()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testVerifyLicenseWithBadRequest ( )
Test:
  • # Test LicenseController::verifyLicense()
  • # Check if HttpBadRequestException is thrown for invalid body
Returns
void
Exceptions

Definition at line 1709 of file LicenseControllerTest.php.

◆ testVerifyLicenseWithNonUniqueName()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testVerifyLicenseWithNonUniqueName ( )
Test:
  • # Test LicenseController::verifyLicense()
  • # Check if status code is 400 for License whose shortName is not unique
  • # Check if HttpBadRequestException is thrown
Returns
void
Exceptions

Definition at line 1735 of file LicenseControllerTest.php.

◆ testVerifyNotFoundLicense()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::testVerifyNotFoundLicense ( )
Test:
  • # Test LicenseController::verifyLicense()
  • # Check if status code is 404 for License which is not found
  • # Check if HttpBadRequestException is thrown
Returns
void
Exceptions

Definition at line 1767 of file LicenseControllerTest.php.

◆ translateLicenseToDb()

Fossology\UI\Api\Test\Controllers\LicenseControllerTest::translateLicenseToDb (   $licenses)
private

Helper function to translate License to DB array

Parameters
array$licenses
Returns
array

Definition at line 297 of file LicenseControllerTest.php.

Member Data Documentation

◆ $adminLicenseAckDao

LicenseAcknowledgementDao Fossology\UI\Api\Test\Controllers\LicenseControllerTest::$adminLicenseAckDao
private

LicenseAcknowledgementDao mock

Definition at line 106 of file LicenseControllerTest.php.

◆ $adminLicensePlugin

M MockInterface Fossology\UI\Api\Test\Controllers\LicenseControllerTest::$adminLicensePlugin
private

admin_license_from_csv mock

Definition at line 118 of file LicenseControllerTest.php.

◆ $assertCountBefore

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

Assertions before running tests

Definition at line 52 of file LicenseControllerTest.php.

◆ $auth

Auth Fossology\UI\Api\Test\Controllers\LicenseControllerTest::$auth
private

Auth mock

Definition at line 137 of file LicenseControllerTest.php.

◆ $dbHelper

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

DbHelper mock

Definition at line 70 of file LicenseControllerTest.php.

◆ $dbManager

DbManager Fossology\UI\Api\Test\Controllers\LicenseControllerTest::$dbManager
private

Dbmanager mock

Definition at line 76 of file LicenseControllerTest.php.

◆ $groupId

integer Fossology\UI\Api\Test\Controllers\LicenseControllerTest::$groupId
private

Group ID to mock

Definition at line 64 of file LicenseControllerTest.php.

◆ $licenseCandidatePlugin

M MockInterface Fossology\UI\Api\Test\Controllers\LicenseControllerTest::$licenseCandidatePlugin
private

admin_license_candidate mock

Definition at line 130 of file LicenseControllerTest.php.

◆ $licenseController

LicenseController Fossology\UI\Api\Test\Controllers\LicenseControllerTest::$licenseController
private

LicenseController mock

Definition at line 88 of file LicenseControllerTest.php.

◆ $licenseDao

LicenseDao Fossology\UI\Api\Test\Controllers\LicenseControllerTest::$licenseDao
private

LicenseDao mock

Definition at line 94 of file LicenseControllerTest.php.

◆ $licenseStdCommentDao

LicenseStdCommentDao Fossology\UI\Api\Test\Controllers\LicenseControllerTest::$licenseStdCommentDao
private

LicenseStdCommentDao mock

Definition at line 112 of file LicenseControllerTest.php.

◆ $restHelper

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

RestHelper mock

Definition at line 82 of file LicenseControllerTest.php.

◆ $streamFactory

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

Stream factory to create body streams.

Definition at line 124 of file LicenseControllerTest.php.

◆ $userDao

UserDao Fossology\UI\Api\Test\Controllers\LicenseControllerTest::$userDao
private

UserDao mock

Definition at line 100 of file LicenseControllerTest.php.

◆ $userId

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

User ID to mock

Definition at line 58 of file LicenseControllerTest.php.


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