FOSSology  4.6.0
Open Source License Compliance by Open Source Software
Fossology\Lib\Dao\LicenseAcknowledgementDaoTest Class Reference
Inheritance diagram for Fossology\Lib\Dao\LicenseAcknowledgementDaoTest:
Inheritance graph
Collaboration diagram for Fossology\Lib\Dao\LicenseAcknowledgementDaoTest:
Collaboration graph

Public Member Functions

 testGetAllAcknowledgementsEverything ()
 Test for LicenseAcknowledgementDao::getAllAcknowledgements() with no skips. More...
 
 testGetAllAcknowledgementsWithSkips ()
 Test for LicenseAcknowledgementDao::getAllAcknowledgements() with skips. More...
 
 testUpdateAcknowledgementAsAdmin ()
 Test for LicenseAcknowledgementDao::updateAcknowledgement() as an admin. More...
 
 testUpdateAcknowledgementAsNonAdmin ()
 Test for LicenseAcknowledgementDao::updateAcknowledgement() as non admin. More...
 
 testUpdateAcknowledgementAsAdminInvalidId ()
 Test for LicenseAcknowledgementDao::updateAcknowledgement() with invalid id. More...
 
 testUpdateAcknowledgementFromArrayAsAdmin ()
 Test for LicenseAcknowledgementDao::updateAcknowledgementFromArray() as admin. More...
 
 testUpdateAcknowledgementFromArrayAsNonAdmin ()
 Test for LicenseAcknowledgementDao::updateAcknowledgementFromArray() as non admin. More...
 
 testUpdateAcknowledgementFromArrayInvalidId ()
 Test for LicenseAcknowledgementDao::updateAcknowledgementFromArray() with invalid id. More...
 
 testUpdateAcknowledgementFromArrayInvalidFields ()
 Test for LicenseAcknowledgementDao::updateAcknowledgementFromArray() with missing fields. More...
 
 testUpdateAcknowledgementFromArrayEmptyArray ()
 Test for LicenseAcknowledgementDao::updateAcknowledgementFromArray() with empty array. More...
 
 testUpdateAcknowledgementFromArrayEmptyValues ()
 Test for LicenseAcknowledgementDao::updateAcknowledgementFromArray() with empty values. More...
 
 testGetAcknowledgementValid ()
 Test for LicenseAcknowledgementDao::getAcknowledgement() with valid id. More...
 
 testGetAcknowledgementInvalid ()
 Test for LicenseAcknowledgementDao::getAcknowledgement() with invalid id. More...
 
 testInsertAcknowledgementAsAdmin ()
 Test for LicenseAcknowledgementDao::insertAcknowledgement() as an admin. More...
 
 testInsertAcknowledgementAsNonAdmin ()
 Test for LicenseAcknowledgementDao::insertAcknowledgement() as non admin. More...
 
 testInsertAcknowledgementEmptyValues ()
 Test for LicenseAcknowledgementDao::insertAcknowledgement() with empty values. More...
 
 testToggleAcknowledgementAsAdmin ()
 Test for LicenseAcknowledgementDao::toggleAcknowledgement() as admin. More...
 
 testToggleAcknowledgementAsNonAdmin ()
 Test for LicenseAcknowledgementDao::toggleAcknowledgement() as non admin. More...
 
 testToggleAcknowledgementInvalidId ()
 Test for LicenseAcknowledgementDao::toggleAcknowledgement() bad id. More...
 

Public Attributes

const ACKNOWLEDGEMENTS_IN_DB = 7
 

Protected Member Functions

 setUp ()
 
 tearDown ()
 

Private Attributes

 $testDb
 
 $dbManager
 
 $licenseAcknowledgementDao
 
 $assertCountBefore
 
 $authClass
 

Detailed Description

Tests for LicenseAcknowledgementDao class @runTestsInSeparateProcesses @preserveGlobalState disabled

Definition at line 25 of file LicenseAcknowledgementDaoTest.php.

Member Function Documentation

◆ testGetAcknowledgementInvalid()

Fossology\Lib\Dao\LicenseAcknowledgementDaoTest::testGetAcknowledgementInvalid ( )

Test for LicenseAcknowledgementDao::getAcknowledgement() with invalid id.

Test:
  1. Call function with invalid id
  2. Check if the function throws exception

Definition at line 354 of file LicenseAcknowledgementDaoTest.php.

◆ testGetAcknowledgementValid()

Fossology\Lib\Dao\LicenseAcknowledgementDaoTest::testGetAcknowledgementValid ( )

Test for LicenseAcknowledgementDao::getAcknowledgement() with valid id.

Test:
  1. Call function with valid id
  2. Check if the function returns string or null
  3. Check if the function returns correct value

Definition at line 337 of file LicenseAcknowledgementDaoTest.php.

◆ testGetAllAcknowledgementsEverything()

Fossology\Lib\Dao\LicenseAcknowledgementDaoTest::testGetAllAcknowledgementsEverything ( )

Test for LicenseAcknowledgementDao::getAllAcknowledgements() with no skips.

Test:
  1. Fetch all set and unset acknowledgements
  2. Check the length of the array matches 7
  3. Check some values

Definition at line 79 of file LicenseAcknowledgementDaoTest.php.

◆ testGetAllAcknowledgementsWithSkips()

Fossology\Lib\Dao\LicenseAcknowledgementDaoTest::testGetAllAcknowledgementsWithSkips ( )

Test for LicenseAcknowledgementDao::getAllAcknowledgements() with skips.

Test:
  1. Fetch all set acknowledgements only
  2. Check the length of the array matches 6
  3. Check unset acknowledgement is not in the array

Definition at line 108 of file LicenseAcknowledgementDaoTest.php.

◆ testInsertAcknowledgementAsAdmin()

Fossology\Lib\Dao\LicenseAcknowledgementDaoTest::testInsertAcknowledgementAsAdmin ( )

Test for LicenseAcknowledgementDao::insertAcknowledgement() as an admin.

Test:
  1. Add a new acknowledgement with some value
  2. Check if the function returns integer
  3. Check if the values are actually inserted in DB

Definition at line 369 of file LicenseAcknowledgementDaoTest.php.

◆ testInsertAcknowledgementAsNonAdmin()

Fossology\Lib\Dao\LicenseAcknowledgementDaoTest::testInsertAcknowledgementAsNonAdmin ( )

Test for LicenseAcknowledgementDao::insertAcknowledgement() as non admin.

Test:
  1. Add a new acknowledgement with some value
  2. Check if the function returns -1

Definition at line 397 of file LicenseAcknowledgementDaoTest.php.

◆ testInsertAcknowledgementEmptyValues()

Fossology\Lib\Dao\LicenseAcknowledgementDaoTest::testInsertAcknowledgementEmptyValues ( )

Test for LicenseAcknowledgementDao::insertAcknowledgement() with empty values.

Test:
  1. Add a new acknowledgement with empty values
  2. Check if the function returns -1

Definition at line 412 of file LicenseAcknowledgementDaoTest.php.

◆ testToggleAcknowledgementAsAdmin()

Fossology\Lib\Dao\LicenseAcknowledgementDaoTest::testToggleAcknowledgementAsAdmin ( )

Test for LicenseAcknowledgementDao::toggleAcknowledgement() as admin.

Test:
  1. Toggle the acknowledgement
  2. Check if the function returns true
  3. Check if the values are updated in DB

Definition at line 428 of file LicenseAcknowledgementDaoTest.php.

◆ testToggleAcknowledgementAsNonAdmin()

Fossology\Lib\Dao\LicenseAcknowledgementDaoTest::testToggleAcknowledgementAsNonAdmin ( )

Test for LicenseAcknowledgementDao::toggleAcknowledgement() as non admin.

Test:
  1. Toggle the acknowledgement as non admin
  2. Check if the function returns false

Definition at line 445 of file LicenseAcknowledgementDaoTest.php.

◆ testToggleAcknowledgementInvalidId()

Fossology\Lib\Dao\LicenseAcknowledgementDaoTest::testToggleAcknowledgementInvalidId ( )

Test for LicenseAcknowledgementDao::toggleAcknowledgement() bad id.

Test:
  1. Toggle the acknowledgement with bad id
  2. Check if the function throws an exception

Definition at line 459 of file LicenseAcknowledgementDaoTest.php.

◆ testUpdateAcknowledgementAsAdmin()

Fossology\Lib\Dao\LicenseAcknowledgementDaoTest::testUpdateAcknowledgementAsAdmin ( )

Test for LicenseAcknowledgementDao::updateAcknowledgement() as an admin.

Test:
  1. Update an acknowledgement with some value
  2. Check if the function returns true
  3. Check if the values are actually updated in DB

Definition at line 137 of file LicenseAcknowledgementDaoTest.php.

◆ testUpdateAcknowledgementAsAdminInvalidId()

Fossology\Lib\Dao\LicenseAcknowledgementDaoTest::testUpdateAcknowledgementAsAdminInvalidId ( )

Test for LicenseAcknowledgementDao::updateAcknowledgement() with invalid id.

Test:
  1. Pass invalid acknowledgement id
  2. Check if the function throws exception

Definition at line 184 of file LicenseAcknowledgementDaoTest.php.

◆ testUpdateAcknowledgementAsNonAdmin()

Fossology\Lib\Dao\LicenseAcknowledgementDaoTest::testUpdateAcknowledgementAsNonAdmin ( )

Test for LicenseAcknowledgementDao::updateAcknowledgement() as non admin.

Test:
  1. Update an acknowledgement with some value
  2. Check if the function returns false
  3. Check if the values are not updated in DB

Definition at line 165 of file LicenseAcknowledgementDaoTest.php.

◆ testUpdateAcknowledgementFromArrayAsAdmin()

Fossology\Lib\Dao\LicenseAcknowledgementDaoTest::testUpdateAcknowledgementFromArrayAsAdmin ( )

Test for LicenseAcknowledgementDao::updateAcknowledgementFromArray() as admin.

Test:
  1. Set user as admin
  2. Update two acknowledgements
  3. Check if the function returns 2
  4. Check if the DB is updated

Definition at line 201 of file LicenseAcknowledgementDaoTest.php.

◆ testUpdateAcknowledgementFromArrayAsNonAdmin()

Fossology\Lib\Dao\LicenseAcknowledgementDaoTest::testUpdateAcknowledgementFromArrayAsNonAdmin ( )

Test for LicenseAcknowledgementDao::updateAcknowledgementFromArray() as non admin.

Test:
  1. Set user as non admin
  2. Call function
  3. Check if the function returns false

Definition at line 238 of file LicenseAcknowledgementDaoTest.php.

◆ testUpdateAcknowledgementFromArrayEmptyArray()

Fossology\Lib\Dao\LicenseAcknowledgementDaoTest::testUpdateAcknowledgementFromArrayEmptyArray ( )

Test for LicenseAcknowledgementDao::updateAcknowledgementFromArray() with empty array.

Test:
  1. Set user as admin
  2. Call function with empty array
  3. Check if the function returns 0

Definition at line 301 of file LicenseAcknowledgementDaoTest.php.

◆ testUpdateAcknowledgementFromArrayEmptyValues()

Fossology\Lib\Dao\LicenseAcknowledgementDaoTest::testUpdateAcknowledgementFromArrayEmptyValues ( )

Test for LicenseAcknowledgementDao::updateAcknowledgementFromArray() with empty values.

Test:
  1. Set user as admin
  2. Call function with empty values
  3. Check if the function throws exception

Definition at line 319 of file LicenseAcknowledgementDaoTest.php.

◆ testUpdateAcknowledgementFromArrayInvalidFields()

Fossology\Lib\Dao\LicenseAcknowledgementDaoTest::testUpdateAcknowledgementFromArrayInvalidFields ( )

Test for LicenseAcknowledgementDao::updateAcknowledgementFromArray() with missing fields.

Test:
  1. Set user as admin
  2. Call function with missing fields
  3. Check if the function throws exception

Definition at line 280 of file LicenseAcknowledgementDaoTest.php.

◆ testUpdateAcknowledgementFromArrayInvalidId()

Fossology\Lib\Dao\LicenseAcknowledgementDaoTest::testUpdateAcknowledgementFromArrayInvalidId ( )

Test for LicenseAcknowledgementDao::updateAcknowledgementFromArray() with invalid id.

Test:
  1. Set user as admin
  2. Call function with invalid data
  3. Check if the function throws exception

Definition at line 259 of file LicenseAcknowledgementDaoTest.php.

Member Data Documentation

◆ $dbManager

DbManager Fossology\Lib\Dao\LicenseAcknowledgementDaoTest::$dbManager
private

DB manager to use

Definition at line 39 of file LicenseAcknowledgementDaoTest.php.

◆ $licenseAcknowledgementDao

LicenseAcknowledgementDao Fossology\Lib\Dao\LicenseAcknowledgementDaoTest::$licenseAcknowledgementDao
private

LicenseAcknowledgementDao object for test

Definition at line 43 of file LicenseAcknowledgementDaoTest.php.

◆ $testDb

TestPgDb Fossology\Lib\Dao\LicenseAcknowledgementDaoTest::$testDb
private

Test DB

Definition at line 35 of file LicenseAcknowledgementDaoTest.php.

◆ ACKNOWLEDGEMENTS_IN_DB

integer Fossology\Lib\Dao\LicenseAcknowledgementDaoTest::ACKNOWLEDGEMENTS_IN_DB = 7

Number of rows in license standard acknowledgements table.

Definition at line 31 of file LicenseAcknowledgementDaoTest.php.


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