FOSSology  4.4.0
Open Source License Compliance by Open Source Software
Fossology\UI\Api\Test\Controllers\JobControllerTest Class Reference

Tests for JobController. More...

Inheritance diagram for Fossology\UI\Api\Test\Controllers\JobControllerTest:
Inheritance graph
Collaboration diagram for Fossology\UI\Api\Test\Controllers\JobControllerTest:
Collaboration graph

Public Member Functions

 testGetJobs ()
 
 testGetJobsLimitPage ()
 
 testGetInvalidJob ()
 
 testGetJobFromId ()
 
 testGetJobsFromUpload ()
 
 testGetUploadEtaInSeconds ()
 
 testGetJobStatus ()
 

Protected Member Functions

 setUp ()
 Setup test objects. More...
 
 tearDown ()
 Remove test objects. More...
 

Private Member Functions

 getResponseJson ($response)
 
 getUsers ($userIds)
 

Private Attributes

 $dbHelper
 
 $restHelper
 
 $jobDao
 
 $showJobsDao
 
 $jobController
 
 $assertCountBefore
 
 $streamFactory
 

Detailed Description

Tests for JobController.

Definition at line 36 of file JobControllerTest.php.

Member Function Documentation

◆ getResponseJson()

Fossology\UI\Api\Test\Controllers\JobControllerTest::getResponseJson (   $response)
private

Helper function to get JSON array from response

Parameters
Response$response
Returns
array Decoded response

Definition at line 122 of file JobControllerTest.php.

◆ getUsers()

Fossology\UI\Api\Test\Controllers\JobControllerTest::getUsers (   $userIds)
private

Generate array of users

Parameters
array$userIdsUser ids to be generated
Returns
array[]

Definition at line 133 of file JobControllerTest.php.

◆ setUp()

Fossology\UI\Api\Test\Controllers\JobControllerTest::setUp ( )
protected

Setup test objects.

See also
PHPUnit_Framework_TestCase::setUp()

Definition at line 84 of file JobControllerTest.php.

◆ tearDown()

Fossology\UI\Api\Test\Controllers\JobControllerTest::tearDown ( )
protected

Remove test objects.

See also
PHPUnit_Framework_TestCase::tearDown()

Definition at line 108 of file JobControllerTest.php.

◆ testGetInvalidJob()

Fossology\UI\Api\Test\Controllers\JobControllerTest::testGetInvalidJob ( )
Test:
  1. Test JobController::getJobs() with invalid job id
  2. Check if response is 404

Definition at line 236 of file JobControllerTest.php.

◆ testGetJobFromId()

Fossology\UI\Api\Test\Controllers\JobControllerTest::testGetJobFromId ( )
Test:
  1. Test JobController::getJobs() with single job id
  2. Check if response is 200

Definition at line 260 of file JobControllerTest.php.

◆ testGetJobs()

Fossology\UI\Api\Test\Controllers\JobControllerTest::testGetJobs ( )
Test:
  1. Test JobController::getJobs() for all jobs
  2. Check if response is 200

Definition at line 158 of file JobControllerTest.php.

◆ testGetJobsFromUpload()

Fossology\UI\Api\Test\Controllers\JobControllerTest::testGetJobsFromUpload ( )
Test:
  1. Test JobController::getJobs() with single upload
  2. Check if response is 200

Definition at line 300 of file JobControllerTest.php.

◆ testGetJobsLimitPage()

Fossology\UI\Api\Test\Controllers\JobControllerTest::testGetJobsLimitPage ( )
Test:
  1. Test JobController::getJobs() with limit and page set
  2. Check if response is 200 and have correct total pages header

Definition at line 195 of file JobControllerTest.php.

◆ testGetJobStatus()

Fossology\UI\Api\Test\Controllers\JobControllerTest::testGetJobStatus ( )
Test:
  1. Test JobController::getJobStatus()
  2. Setup one job with two complete children => result Completed
  3. Setup one job with one child processing and other in queue => result Processing
  4. Setup one job with one child completed and one failed => result Failed

Definition at line 375 of file JobControllerTest.php.

◆ testGetUploadEtaInSeconds()

Fossology\UI\Api\Test\Controllers\JobControllerTest::testGetUploadEtaInSeconds ( )
Test:
  1. Test JobController::getUploadEtaInSeconds()
  2. Test if HH:MM:SS can be translated to seconds
  3. Test if empty response results in 0

Definition at line 343 of file JobControllerTest.php.

Member Data Documentation

◆ $assertCountBefore

integer Fossology\UI\Api\Test\Controllers\JobControllerTest::$assertCountBefore
private

Assertions before running tests

Definition at line 72 of file JobControllerTest.php.

◆ $dbHelper

DbHelper Fossology\UI\Api\Test\Controllers\JobControllerTest::$dbHelper
private

DB Helper mock

Definition at line 42 of file JobControllerTest.php.

◆ $jobController

JobController Fossology\UI\Api\Test\Controllers\JobControllerTest::$jobController
private

JobController object to test

Definition at line 66 of file JobControllerTest.php.

◆ $jobDao

JobDao Fossology\UI\Api\Test\Controllers\JobControllerTest::$jobDao
private

JobDao mock

Definition at line 54 of file JobControllerTest.php.

◆ $restHelper

RestHelper Fossology\UI\Api\Test\Controllers\JobControllerTest::$restHelper
private

RestHelper mock

Definition at line 48 of file JobControllerTest.php.

◆ $showJobsDao

ShowJobsDao Fossology\UI\Api\Test\Controllers\JobControllerTest::$showJobsDao
private

ShowJobsDao mock

Definition at line 60 of file JobControllerTest.php.

◆ $streamFactory

StreamFactory Fossology\UI\Api\Test\Controllers\JobControllerTest::$streamFactory
private

Stream factory to create body streams.

Definition at line 78 of file JobControllerTest.php.


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