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

Public Member Functions

 testGetAllCommentsEverything ()
 Test for LicenseStdCommentDao::getAllComments() with no skips. More...
 
 testGetAllCommentsWithSkips ()
 Test for LicenseStdCommentDao::getAllComments() with skips. More...
 
 testUpdateCommentAsAdmin ()
 Test for LicenseStdCommentDao::updateComment() as an admin. More...
 
 testUpdateCommentAsNonAdmin ()
 Test for LicenseStdCommentDao::updateComment() as non admin. More...
 
 testUpdateCommentAsAdminInvalidId ()
 Test for LicenseStdCommentDao::updateComment() with invalid id. More...
 
 testUpdateCommentFromArrayAsAdmin ()
 Test for LicenseStdCommentDao::updateCommentFromArray() as admin. More...
 
 testUpdateCommentFromArrayAsNonAdmin ()
 Test for LicenseStdCommentDao::updateCommentFromArray() as non admin. More...
 
 testUpdateCommentFromArrayInvalidId ()
 Test for LicenseStdCommentDao::updateCommentFromArray() with invalid id. More...
 
 testUpdateCommentFromArrayInvalidFields ()
 Test for LicenseStdCommentDao::updateCommentFromArray() with missing fields. More...
 
 testUpdateCommentFromArrayEmptyArray ()
 Test for LicenseStdCommentDao::updateCommentFromArray() with empty array. More...
 
 testUpdateCommentFromArrayEmptyValues ()
 Test for LicenseStdCommentDao::updateCommentFromArray() with empty values. More...
 
 testGetCommentValid ()
 Test for LicenseStdCommentDao::getComment() with valid id. More...
 
 testGetCommentInvalid ()
 Test for LicenseStdCommentDao::getComment() with invalid id. More...
 
 testInsertCommentAsAdmin ()
 Test for LicenseStdCommentDao::insertComment() as an admin. More...
 
 testInsertCommentAsNonAdmin ()
 Test for LicenseStdCommentDao::insertComment() as non admin. More...
 
 testInsertCommentEmptyValues ()
 Test for LicenseStdCommentDao::insertComment() with empty values. More...
 
 testToggleCommentAsAdmin ()
 Test for LicenseStdCommentDao::toggleComment() as admin. More...
 
 testToggleCommentAsNonAdmin ()
 Test for LicenseStdCommentDao::toggleComment() as non admin. More...
 
 testToggleCommentInvalidId ()
 Test for LicenseStdCommentDao::toggleComment() bad id. More...
 

Public Attributes

const COMMENTS_IN_DB = 7
 

Protected Member Functions

 setUp ()
 
 tearDown ()
 

Private Attributes

 $testDb
 
 $dbManager
 
 $licenseStdCommentDao
 
 $assertCountBefore
 
 $authClass
 

Detailed Description

Tests for LicenseStdCommentDao class @runTestsInSeparateProcesses @preserveGlobalState disabled

Definition at line 25 of file LicenseStdCommentDaoTest.php.

Member Function Documentation

◆ testGetAllCommentsEverything()

Fossology\Lib\Dao\LicenseStdCommentDaoTest::testGetAllCommentsEverything ( )

Test for LicenseStdCommentDao::getAllComments() with no skips.

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

Definition at line 79 of file LicenseStdCommentDaoTest.php.

◆ testGetAllCommentsWithSkips()

Fossology\Lib\Dao\LicenseStdCommentDaoTest::testGetAllCommentsWithSkips ( )

Test for LicenseStdCommentDao::getAllComments() with skips.

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

Definition at line 108 of file LicenseStdCommentDaoTest.php.

◆ testGetCommentInvalid()

Fossology\Lib\Dao\LicenseStdCommentDaoTest::testGetCommentInvalid ( )

Test for LicenseStdCommentDao::getComment() with invalid id.

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

Definition at line 354 of file LicenseStdCommentDaoTest.php.

◆ testGetCommentValid()

Fossology\Lib\Dao\LicenseStdCommentDaoTest::testGetCommentValid ( )

Test for LicenseStdCommentDao::getComment() 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 LicenseStdCommentDaoTest.php.

◆ testInsertCommentAsAdmin()

Fossology\Lib\Dao\LicenseStdCommentDaoTest::testInsertCommentAsAdmin ( )

Test for LicenseStdCommentDao::insertComment() as an admin.

Test:
  1. Add a new comment 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 LicenseStdCommentDaoTest.php.

◆ testInsertCommentAsNonAdmin()

Fossology\Lib\Dao\LicenseStdCommentDaoTest::testInsertCommentAsNonAdmin ( )

Test for LicenseStdCommentDao::insertComment() as non admin.

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

Definition at line 397 of file LicenseStdCommentDaoTest.php.

◆ testInsertCommentEmptyValues()

Fossology\Lib\Dao\LicenseStdCommentDaoTest::testInsertCommentEmptyValues ( )

Test for LicenseStdCommentDao::insertComment() with empty values.

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

Definition at line 412 of file LicenseStdCommentDaoTest.php.

◆ testToggleCommentAsAdmin()

Fossology\Lib\Dao\LicenseStdCommentDaoTest::testToggleCommentAsAdmin ( )

Test for LicenseStdCommentDao::toggleComment() as admin.

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

Definition at line 428 of file LicenseStdCommentDaoTest.php.

◆ testToggleCommentAsNonAdmin()

Fossology\Lib\Dao\LicenseStdCommentDaoTest::testToggleCommentAsNonAdmin ( )

Test for LicenseStdCommentDao::toggleComment() as non admin.

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

Definition at line 445 of file LicenseStdCommentDaoTest.php.

◆ testToggleCommentInvalidId()

Fossology\Lib\Dao\LicenseStdCommentDaoTest::testToggleCommentInvalidId ( )

Test for LicenseStdCommentDao::toggleComment() bad id.

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

Definition at line 459 of file LicenseStdCommentDaoTest.php.

◆ testUpdateCommentAsAdmin()

Fossology\Lib\Dao\LicenseStdCommentDaoTest::testUpdateCommentAsAdmin ( )

Test for LicenseStdCommentDao::updateComment() as an admin.

Test:
  1. Update a comment 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 LicenseStdCommentDaoTest.php.

◆ testUpdateCommentAsAdminInvalidId()

Fossology\Lib\Dao\LicenseStdCommentDaoTest::testUpdateCommentAsAdminInvalidId ( )

Test for LicenseStdCommentDao::updateComment() with invalid id.

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

Definition at line 184 of file LicenseStdCommentDaoTest.php.

◆ testUpdateCommentAsNonAdmin()

Fossology\Lib\Dao\LicenseStdCommentDaoTest::testUpdateCommentAsNonAdmin ( )

Test for LicenseStdCommentDao::updateComment() as non admin.

Test:
  1. Update a comment 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 LicenseStdCommentDaoTest.php.

◆ testUpdateCommentFromArrayAsAdmin()

Fossology\Lib\Dao\LicenseStdCommentDaoTest::testUpdateCommentFromArrayAsAdmin ( )

Test for LicenseStdCommentDao::updateCommentFromArray() as admin.

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

Definition at line 201 of file LicenseStdCommentDaoTest.php.

◆ testUpdateCommentFromArrayAsNonAdmin()

Fossology\Lib\Dao\LicenseStdCommentDaoTest::testUpdateCommentFromArrayAsNonAdmin ( )

Test for LicenseStdCommentDao::updateCommentFromArray() 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 LicenseStdCommentDaoTest.php.

◆ testUpdateCommentFromArrayEmptyArray()

Fossology\Lib\Dao\LicenseStdCommentDaoTest::testUpdateCommentFromArrayEmptyArray ( )

Test for LicenseStdCommentDao::updateCommentFromArray() 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 LicenseStdCommentDaoTest.php.

◆ testUpdateCommentFromArrayEmptyValues()

Fossology\Lib\Dao\LicenseStdCommentDaoTest::testUpdateCommentFromArrayEmptyValues ( )

Test for LicenseStdCommentDao::updateCommentFromArray() 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 LicenseStdCommentDaoTest.php.

◆ testUpdateCommentFromArrayInvalidFields()

Fossology\Lib\Dao\LicenseStdCommentDaoTest::testUpdateCommentFromArrayInvalidFields ( )

Test for LicenseStdCommentDao::updateCommentFromArray() 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 LicenseStdCommentDaoTest.php.

◆ testUpdateCommentFromArrayInvalidId()

Fossology\Lib\Dao\LicenseStdCommentDaoTest::testUpdateCommentFromArrayInvalidId ( )

Test for LicenseStdCommentDao::updateCommentFromArray() 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 LicenseStdCommentDaoTest.php.

Member Data Documentation

◆ $dbManager

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

DB manager to use

Definition at line 39 of file LicenseStdCommentDaoTest.php.

◆ $licenseStdCommentDao

LicenseStdCommentDao Fossology\Lib\Dao\LicenseStdCommentDaoTest::$licenseStdCommentDao
private

LicenseStdCommentDao object for test

Definition at line 43 of file LicenseStdCommentDaoTest.php.

◆ $testDb

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

Test DB

Definition at line 35 of file LicenseStdCommentDaoTest.php.

◆ COMMENTS_IN_DB

integer Fossology\Lib\Dao\LicenseStdCommentDaoTest::COMMENTS_IN_DB = 7

Number of rows in license standard comments table.

Definition at line 31 of file LicenseStdCommentDaoTest.php.


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