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

Public Member Functions

 testInsertRule ()
 Test for CompatibilityDao::insertRule() More...
 
 testInsertRuleWithoutComment ()
 Test for CompatibilityDao::insertRule() with an empty description. More...
 
 testGetRuleById ()
 Test for CompatibilityDao::getRuleById() More...
 
 testGetAllRulesPaginated ()
 Test for CompatibilityDao::getAllRules() with pagination. More...
 
 testGetAllRulesWithSearchTerm ()
 Test for CompatibilityDao::getAllRules() with a search term. More...
 
 testGetAllRulesWithQuoteInSearchTerm ()
 Test that the search term is bound as a query parameter. More...
 
 testUpdateRuleCompatibilityFromBoolean ()
 Test for CompatibilityDao::updateRuleFromArray() with a boolean. More...
 
 testUpdateRuleCompatibilityFromDbBoolean ()
 Test for CompatibilityDao::updateRuleFromArray() with the DB representation of a boolean. More...
 
 testUpdateRuleFromArray ()
 Test for CompatibilityDao::updateRuleFromArray() on every field. More...
 
 testUpdateRuleWithUnknownId ()
 Test for CompatibilityDao::updateRuleFromArray() with an unknown id. More...
 
 testDeleteRule ()
 Test for CompatibilityDao::deleteRule() More...
 

Protected Member Functions

 setUp ()
 
 tearDown ()
 

Private Member Functions

 insertRule ($comment, $result=true)
 Insert a rule to work on. More...
 

Private Attributes

 $testDb
 
 $dbManager
 
 $compatibilityDao
 
 $assertCountBefore
 
 $authClass
 
 $firstLicenseId
 
 $secondLicenseId
 

Detailed Description

Tests for CompatibilityDao class @runTestsInSeparateProcesses @preserveGlobalState disabled

Definition at line 25 of file CompatibilityDaoTest.php.

Member Function Documentation

◆ insertRule()

Fossology\Lib\Dao\CompatibilityDaoTest::insertRule (   $comment,
  $result = true 
)
private

Insert a rule to work on.

Parameters
string$commentDescription of the rule
bool$resultCompatibility of the rule
Returns
int Id of the new rule

Definition at line 93 of file CompatibilityDaoTest.php.

◆ testDeleteRule()

Fossology\Lib\Dao\CompatibilityDaoTest::testDeleteRule ( )

Test for CompatibilityDao::deleteRule()

Test:
  1. Delete an existing rule
  2. Check if the rule is gone from the DB

Definition at line 301 of file CompatibilityDaoTest.php.

◆ testGetAllRulesPaginated()

Fossology\Lib\Dao\CompatibilityDaoTest::testGetAllRulesPaginated ( )

Test for CompatibilityDao::getAllRules() with pagination.

Test:
  1. Insert three rules
  2. Fetch them one page at a time
  3. Check if the rules are returned ordered by their id

Definition at line 159 of file CompatibilityDaoTest.php.

◆ testGetAllRulesWithQuoteInSearchTerm()

Fossology\Lib\Dao\CompatibilityDaoTest::testGetAllRulesWithQuoteInSearchTerm ( )

Test that the search term is bound as a query parameter.

Test:
  1. Search with a term holding a single quote
  2. Check that the query does not break and matches nothing

Definition at line 202 of file CompatibilityDaoTest.php.

◆ testGetAllRulesWithSearchTerm()

Fossology\Lib\Dao\CompatibilityDaoTest::testGetAllRulesWithSearchTerm ( )

Test for CompatibilityDao::getAllRules() with a search term.

Test:
  1. Insert two rules with different descriptions
  2. Search for one of them
  3. Check if only the matching rule is returned and counted

Definition at line 184 of file CompatibilityDaoTest.php.

◆ testGetRuleById()

Fossology\Lib\Dao\CompatibilityDaoTest::testGetRuleById ( )

Test for CompatibilityDao::getRuleById()

Test:
  1. Fetch a rule which exists
  2. Check if the license short name is resolved
  3. Fetch a rule which does not exist
  4. Check if null is returned

Definition at line 140 of file CompatibilityDaoTest.php.

◆ testInsertRule()

Fossology\Lib\Dao\CompatibilityDaoTest::testInsertRule ( )

Test for CompatibilityDao::insertRule()

Test:
  1. Insert a rule with a boolean compatibility
  2. Check if the values are stored as given

Definition at line 107 of file CompatibilityDaoTest.php.

◆ testInsertRuleWithoutComment()

Fossology\Lib\Dao\CompatibilityDaoTest::testInsertRuleWithoutComment ( )

Test for CompatibilityDao::insertRule() with an empty description.

Test:
  1. Insert a rule without a description
  2. Check if the rule is rejected

Definition at line 126 of file CompatibilityDaoTest.php.

◆ testUpdateRuleCompatibilityFromBoolean()

Fossology\Lib\Dao\CompatibilityDaoTest::testUpdateRuleCompatibilityFromBoolean ( )

Test for CompatibilityDao::updateRuleFromArray() with a boolean.

Test:
  1. Update only the compatibility of a rule with a PHP boolean
  2. Check if the new value is stored in the DB

Definition at line 219 of file CompatibilityDaoTest.php.

◆ testUpdateRuleCompatibilityFromDbBoolean()

Fossology\Lib\Dao\CompatibilityDaoTest::testUpdateRuleCompatibilityFromDbBoolean ( )

Test for CompatibilityDao::updateRuleFromArray() with the DB representation of a boolean.

Test:
  1. Update the compatibility of a rule with 't' and 'f'
  2. Check if the new value is stored in the DB

Definition at line 241 of file CompatibilityDaoTest.php.

◆ testUpdateRuleFromArray()

Fossology\Lib\Dao\CompatibilityDaoTest::testUpdateRuleFromArray ( )

Test for CompatibilityDao::updateRuleFromArray() on every field.

Test:
  1. Update all the fields of a rule
  2. Check if the new values are stored in the DB

Definition at line 257 of file CompatibilityDaoTest.php.

◆ testUpdateRuleWithUnknownId()

Fossology\Lib\Dao\CompatibilityDaoTest::testUpdateRuleWithUnknownId ( )

Test for CompatibilityDao::updateRuleFromArray() with an unknown id.

Test:
  1. Update a rule which does not exist
  2. Check if UnexpectedValueException is thrown

Definition at line 287 of file CompatibilityDaoTest.php.

Member Data Documentation

◆ $authClass

M MockInterface Fossology\Lib\Dao\CompatibilityDaoTest::$authClass
private

Alias mock of the Auth class

Definition at line 44 of file CompatibilityDaoTest.php.

◆ $compatibilityDao

CompatibilityDao Fossology\Lib\Dao\CompatibilityDaoTest::$compatibilityDao
private

CompatibilityDao object for test

Definition at line 37 of file CompatibilityDaoTest.php.

◆ $dbManager

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

DB manager to use

Definition at line 33 of file CompatibilityDaoTest.php.

◆ $firstLicenseId

int Fossology\Lib\Dao\CompatibilityDaoTest::$firstLicenseId
private

Id of a license present in license_ref

Definition at line 48 of file CompatibilityDaoTest.php.

◆ $secondLicenseId

int Fossology\Lib\Dao\CompatibilityDaoTest::$secondLicenseId
private

Id of another license present in license_ref

Definition at line 52 of file CompatibilityDaoTest.php.

◆ $testDb

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

Test DB

Definition at line 29 of file CompatibilityDaoTest.php.


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