FOSSology  4.4.0
Open Source License Compliance by Open Source Software
OjoScheduledTest Class Reference

Functional test cases for ojo agent using scheduler. More...

Inheritance diagram for OjoScheduledTest:
Inheritance graph
Collaboration diagram for OjoScheduledTest:
Collaboration graph

Public Member Functions

 testRun ()
 Run the test. More...
 
 testCli ()
 Run the test for CLI. More...
 
 regressionTest ()
 Run a regression test for OJO. More...
 

Protected Member Functions

 setUp ()
 Setup the test cases and initialize the objects. More...
 
 tearDown ()
 Destruct the objects initialized during setUp() More...
 

Private Member Functions

 setUpRepo ()
 Setup test repo mimicking install.
 
 rmRepo ()
 Remove the test repo.
 
 setUpTables ()
 Setup tables required by copyright agent.
 
 resultArrayContainsLicense ($resultArray, $licenseName)
 
 compareMatches ($left, $right)
 Compare two matches from OJO (slow) More...
 
 compareMatchesFiles ($left, $right)
 

Private Attributes

 $testDb
 
 $dbManager
 
 $licenseDao
 
 $testInstaller
 
 $uploadDao
 
 $uploadPermDao
 
 $cliRunner
 
 $schedulerRunner
 
 $regressionFile
 

Detailed Description

Functional test cases for ojo agent using scheduler.

Definition at line 29 of file schedulerTest.php.

Member Function Documentation

◆ compareMatches()

OjoScheduledTest::compareMatches (   $left,
  $right 
)
private

Compare two matches from OJO (slow)

The comparision algorithm is as follows:

  1. Check if we are comparing results from same file.
  2. Check if results are not null. The operand with null result will be smaller if other one is not null. Otherwise they will equal.
  3. Check if size of results are equal.
  4. At last, check the license of each result.
    Parameters
    array$leftLeft match
    array$rightRight match
    Returns
    number -1 if right is small, 1 is left is small or 0 if both are equal

Definition at line 220 of file schedulerTest.php.

◆ compareMatchesFiles()

OjoScheduledTest::compareMatchesFiles (   $left,
  $right 
)
private

Compare two matches based on file name only (fast).

Parameters
array$leftLeft match
array$rightRight match
Returns
number strcmp of left filename and right filename

Definition at line 253 of file schedulerTest.php.

◆ regressionTest()

OjoScheduledTest::regressionTest ( )

Run a regression test for OJO.

Test:
  1. Run ojo on a test directory
  2. Check if ojo returns a JSON
  3. Check if the returned JSON matches last run

Definition at line 353 of file schedulerTest.php.

◆ resultArrayContainsLicense()

OjoScheduledTest::resultArrayContainsLicense (   $resultArray,
  $licenseName 
)
private

Check if the result array from ojo contains given license.

Parameters
array$resultArrayResult array of a match
string$licenseNameLicense to search
Returns
boolean True if it contains the license, false otherwise

Definition at line 196 of file schedulerTest.php.

◆ setUp()

OjoScheduledTest::setUp ( )
protected

Setup the test cases and initialize the objects.

See also
PHPUnit_Framework_TestCase::setUp()

Definition at line 73 of file schedulerTest.php.

◆ tearDown()

OjoScheduledTest::tearDown ( )
protected

Destruct the objects initialized during setUp()

See also
PHPUnit_Framework_TestCase::tearDown()

Definition at line 95 of file schedulerTest.php.

◆ testCli()

OjoScheduledTest::testCli ( )

Run the test for CLI.

Test:
  1. Run ojo on a test file
  2. Check if ojo returns a JSON
  3. Check if the returned JSON contains correct data

Definition at line 320 of file schedulerTest.php.

◆ testRun()

OjoScheduledTest::testRun ( )

Run the test.

Test:
  1. Setup test tables
  2. Setup test repo
  3. Run ojo on upload id 4
  4. Remove test repo
  5. Check entries in license_file table

Definition at line 267 of file schedulerTest.php.


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