FOSSology  4.7.1
Open Source License Compliance by Open Source Software
Fossology\Lib\Application\LicenseCompatibilityRulesYamlImportTest Class Reference

Test for LicenseCompatibilityRulesYamlImport. More...

Inheritance diagram for Fossology\Lib\Application\LicenseCompatibilityRulesYamlImportTest:
Inheritance graph
Collaboration diagram for Fossology\Lib\Application\LicenseCompatibilityRulesYamlImportTest:
Collaboration graph

Public Member Functions

 testUpdateLicenseWithOnlyCompatibilityChanged ()
 Test for LicenseCompatibilityRulesYamlImport::updateLicense() when only the compatibility changed. More...
 
 testUpdateLicenseWithOnlyCommentChanged ()
 Test for LicenseCompatibilityRulesYamlImport::updateLicense() when only the description changed. More...
 
 testUpdateLicenseWithBothChanged ()
 Test for LicenseCompatibilityRulesYamlImport::updateLicense() when both values changed. More...
 
 testUpdateLicenseWithNoChange ()
 Test for LicenseCompatibilityRulesYamlImport::updateLicense() when nothing changed. More...
 
 testHandleYamlWithUnknownLicense ()
 Test for LicenseCompatibilityRulesYamlImport::handleYaml() with a license unknown to the server. More...
 
 testHandleYamlWithMissingColumn ()
 Test for LicenseCompatibilityRulesYamlImport::handleYaml() with a missing column. More...
 
 testHandleYamlResolvesLicenseIds ()
 Test for LicenseCompatibilityRulesYamlImport::handleYaml() resolving the license short names. More...
 

Protected Member Functions

 setUp ()
 One time setup for test. More...
 
 tearDown ()
 Close mockery. More...
 

Private Member Functions

 whenStoredRuleIs ($compatibility, $comment)
 Make the DB return the given rule as the currently stored one. More...
 

Private Attributes

 $dbManager
 
 $licenseDao
 
 $compatibilityDao
 
 $yamlImport
 
 $assertCountBefore
 

Detailed Description

Member Function Documentation

◆ setUp()

Fossology\Lib\Application\LicenseCompatibilityRulesYamlImportTest::setUp ( )
protected

One time setup for test.

See also
PHPUnit::Framework::TestCase::setUp()

Definition at line 47 of file LicenseCompatibilityRulesYamlImportTest.php.

◆ tearDown()

Fossology\Lib\Application\LicenseCompatibilityRulesYamlImportTest::tearDown ( )
protected

Close mockery.

See also
PHPUnit::Framework::TestCase::tearDown()

Definition at line 66 of file LicenseCompatibilityRulesYamlImportTest.php.

◆ testHandleYamlResolvesLicenseIds()

Fossology\Lib\Application\LicenseCompatibilityRulesYamlImportTest::testHandleYamlResolvesLicenseIds ( )

Test for LicenseCompatibilityRulesYamlImport::handleYaml() resolving the license short names.

Test:
  1. Import a rule naming two known licenses
  2. Check if the short names are replaced by the license ids

Definition at line 219 of file LicenseCompatibilityRulesYamlImportTest.php.

◆ testHandleYamlWithMissingColumn()

Fossology\Lib\Application\LicenseCompatibilityRulesYamlImportTest::testHandleYamlWithMissingColumn ( )

Test for LicenseCompatibilityRulesYamlImport::handleYaml() with a missing column.

Test:
  1. Import a rule without the compatibility column
  2. Check if UnexpectedValueException is thrown

Definition at line 198 of file LicenseCompatibilityRulesYamlImportTest.php.

◆ testHandleYamlWithUnknownLicense()

Fossology\Lib\Application\LicenseCompatibilityRulesYamlImportTest::testHandleYamlWithUnknownLicense ( )

Test for LicenseCompatibilityRulesYamlImport::handleYaml() with a license unknown to the server.

Test:
  1. Import a rule naming a license which is not in the DB
  2. Check if UnexpectedValueException is thrown instead of a fatal error

Definition at line 174 of file LicenseCompatibilityRulesYamlImportTest.php.

◆ testUpdateLicenseWithBothChanged()

Fossology\Lib\Application\LicenseCompatibilityRulesYamlImportTest::testUpdateLicenseWithBothChanged ( )

Test for LicenseCompatibilityRulesYamlImport::updateLicense() when both values changed.

Test:
  1. Import a rule with a new compatibility and a new description
  2. Check if the DAO is asked to update both

Definition at line 133 of file LicenseCompatibilityRulesYamlImportTest.php.

◆ testUpdateLicenseWithNoChange()

Fossology\Lib\Application\LicenseCompatibilityRulesYamlImportTest::testUpdateLicenseWithNoChange ( )

Test for LicenseCompatibilityRulesYamlImport::updateLicense() when nothing changed.

Test:
  1. Import a rule which matches the stored one
  2. Check if the DAO is not called
  3. Check if nothing is reported

Definition at line 155 of file LicenseCompatibilityRulesYamlImportTest.php.

◆ testUpdateLicenseWithOnlyCommentChanged()

Fossology\Lib\Application\LicenseCompatibilityRulesYamlImportTest::testUpdateLicenseWithOnlyCommentChanged ( )

Test for LicenseCompatibilityRulesYamlImport::updateLicense() when only the description changed.

Test:
  1. Import a rule whose description differs from the stored one
  2. Check if the DAO is asked to update the description
  3. Check if the change is reported

Definition at line 113 of file LicenseCompatibilityRulesYamlImportTest.php.

◆ testUpdateLicenseWithOnlyCompatibilityChanged()

Fossology\Lib\Application\LicenseCompatibilityRulesYamlImportTest::testUpdateLicenseWithOnlyCompatibilityChanged ( )

Test for LicenseCompatibilityRulesYamlImport::updateLicense() when only the compatibility changed.

Test:
  1. Import a rule whose compatibility differs from the stored one
  2. Check if the DAO is asked to update the compatibility
  3. Check if the change is reported

Definition at line 92 of file LicenseCompatibilityRulesYamlImportTest.php.

◆ whenStoredRuleIs()

Fossology\Lib\Application\LicenseCompatibilityRulesYamlImportTest::whenStoredRuleIs (   $compatibility,
  $comment 
)
private

Make the DB return the given rule as the currently stored one.

Parameters
string$compatibilityStored compatibility, 't' or 'f'
string$commentStored description

Definition at line 78 of file LicenseCompatibilityRulesYamlImportTest.php.

Member Data Documentation

◆ $compatibilityDao

CompatibilityDao Fossology\Lib\Application\LicenseCompatibilityRulesYamlImportTest::$compatibilityDao
private

CompatibilityDao mock

Definition at line 34 of file LicenseCompatibilityRulesYamlImportTest.php.

◆ $dbManager

DbManager Fossology\Lib\Application\LicenseCompatibilityRulesYamlImportTest::$dbManager
private

DbManager mock

Definition at line 26 of file LicenseCompatibilityRulesYamlImportTest.php.

◆ $licenseDao

LicenseDao Fossology\Lib\Application\LicenseCompatibilityRulesYamlImportTest::$licenseDao
private

LicenseDao mock

Definition at line 30 of file LicenseCompatibilityRulesYamlImportTest.php.

◆ $yamlImport

LicenseCompatibilityRulesYamlImport Fossology\Lib\Application\LicenseCompatibilityRulesYamlImportTest::$yamlImport
private

Object under test

Definition at line 38 of file LicenseCompatibilityRulesYamlImportTest.php.


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