FOSSology  3.2.0rc1
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 disabled

Definition at line 33 of file LicenseStdCommentDaoTest.php.

Member Function Documentation

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 87 of file LicenseStdCommentDaoTest.php.

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 112 of file LicenseStdCommentDaoTest.php.

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 343 of file LicenseStdCommentDaoTest.php.

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 326 of file LicenseStdCommentDaoTest.php.

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 358 of file LicenseStdCommentDaoTest.php.

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 381 of file LicenseStdCommentDaoTest.php.

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 396 of file LicenseStdCommentDaoTest.php.

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 412 of file LicenseStdCommentDaoTest.php.

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 429 of file LicenseStdCommentDaoTest.php.

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 443 of file LicenseStdCommentDaoTest.php.

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.

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 178 of file LicenseStdCommentDaoTest.php.

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 159 of file LicenseStdCommentDaoTest.php.

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 195 of file LicenseStdCommentDaoTest.php.

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 227 of file LicenseStdCommentDaoTest.php.

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 290 of file LicenseStdCommentDaoTest.php.

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 308 of file LicenseStdCommentDaoTest.php.

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 269 of file LicenseStdCommentDaoTest.php.

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 248 of file LicenseStdCommentDaoTest.php.

Member Data Documentation

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

DB manager to use

Definition at line 47 of file LicenseStdCommentDaoTest.php.

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

LicenseStdCommentDao object for test

Definition at line 51 of file LicenseStdCommentDaoTest.php.

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

Test DB

Definition at line 43 of file LicenseStdCommentDaoTest.php.

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

Number of rows in license standard comments table.

Definition at line 39 of file LicenseStdCommentDaoTest.php.


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