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

Tests for MaintenanceController. More...

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

Public Member Functions

 testCreateMaintenance ()
 
 testCreateMaintenanceUserNotAdmin ()
 
 testCreateMaintenanceWithBadRequest ()
 
 testCreateMaintenanceOptionKeyNotFound ()
 
 testCreateMaintenanceInvalidGoldDate ()
 
 testCreateMaintenanceInvalidLogsDate ()
 

Public Attributes

const YAML_LOC = __DIR__ . '/../../../ui/api/documentation/openapi.yaml'
 

Protected Member Functions

 setUp ()
 Setup test objects. More...
 

Private Member Functions

 getResponseJson ($response)
 

Private Attributes

 $maintenanceController
 
 $assertCountBefore
 
 $dbHelper
 
 $restHelper
 
 $auth
 
 $maintagentPlugin
 
 $rq
 
 $OPTIONS =[]
 

Detailed Description

Tests for MaintenanceController.

Definition at line 39 of file MaintenanceControllerTest.php.

Member Function Documentation

◆ getResponseJson()

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

Helper function to get JSON array from response

Parameters
Response$response
Returns
array Decoded response

Definition at line 153 of file MaintenanceControllerTest.php.

◆ setUp()

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

Setup test objects.

See also
PHPUnit_Framework_TestCase::setUp()

Setup test objects

See also
PHPUnit_Framework_TestCase::setUp()

Definition at line 103 of file MaintenanceControllerTest.php.

◆ testCreateMaintenance()

Fossology\UI\Api\Test\Controllers\MaintenanceControllerTest::testCreateMaintenance ( )
Test:
  1. Test MaintenanceController::testCreateMaintenance() for valid create maintenance request
  2. Check if response status is 201

Definition at line 164 of file MaintenanceControllerTest.php.

◆ testCreateMaintenanceInvalidGoldDate()

Fossology\UI\Api\Test\Controllers\MaintenanceControllerTest::testCreateMaintenanceInvalidGoldDate ( )
Test:
  1. Test MaintenanceController::testCreateMaintenance() for valid create maintenance
  2. Check if HttBadRequestException is thrown when GoldDate is not provided

Definition at line 316 of file MaintenanceControllerTest.php.

◆ testCreateMaintenanceInvalidLogsDate()

Fossology\UI\Api\Test\Controllers\MaintenanceControllerTest::testCreateMaintenanceInvalidLogsDate ( )
Test:
  1. Test MaintenanceController::testCreateMaintenance() for valid create maintenance
  2. Check if HttBadRequestException is thrown when LogsDate is not provided

Definition at line 355 of file MaintenanceControllerTest.php.

◆ testCreateMaintenanceOptionKeyNotFound()

Fossology\UI\Api\Test\Controllers\MaintenanceControllerTest::testCreateMaintenanceOptionKeyNotFound ( )
Test:
  1. Test MaintenanceController::testCreateMaintenance() for valid create maintenance
  2. Check if HttpNotFoundException is thrown when unknown key is encountered

Definition at line 281 of file MaintenanceControllerTest.php.

◆ testCreateMaintenanceUserNotAdmin()

Fossology\UI\Api\Test\Controllers\MaintenanceControllerTest::testCreateMaintenanceUserNotAdmin ( )
Test:
  1. Test MaintenanceController::testCreateMaintenance() for valid create maintenance
  2. Check if access is denied with HttpForbiddenException for non admin users

Definition at line 223 of file MaintenanceControllerTest.php.

◆ testCreateMaintenanceWithBadRequest()

Fossology\UI\Api\Test\Controllers\MaintenanceControllerTest::testCreateMaintenanceWithBadRequest ( )
Test:
  1. Test MaintenanceController::testCreateMaintenance() for valid create maintenance
  2. Check if access is denied with HttpForbiddenException for non admin users

Definition at line 257 of file MaintenanceControllerTest.php.

Member Data Documentation

◆ $assertCountBefore

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

Assertions before running tests

Definition at line 59 of file MaintenanceControllerTest.php.

◆ $auth

Auth Fossology\UI\Api\Test\Controllers\MaintenanceControllerTest::$auth
private

Auth mock

Definition at line 77 of file MaintenanceControllerTest.php.

◆ $dbHelper

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

DbHelper mock

Definition at line 65 of file MaintenanceControllerTest.php.

◆ $maintagentPlugin

M MockInterface Fossology\UI\Api\Test\Controllers\MaintenanceControllerTest::$maintagentPlugin
private

maintagentPlugin mock

Definition at line 83 of file MaintenanceControllerTest.php.

◆ $maintenanceController

MaintenanceController Fossology\UI\Api\Test\Controllers\MaintenanceControllerTest::$maintenanceController
private

MaintenanceController object to test

Definition at line 53 of file MaintenanceControllerTest.php.

◆ $restHelper

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

RestHelper mock

Definition at line 71 of file MaintenanceControllerTest.php.

◆ YAML_LOC

string Fossology\UI\Api\Test\Controllers\MaintenanceControllerTest::YAML_LOC = __DIR__ . '/../../../ui/api/documentation/openapi.yaml'

Location of openapi.yaml file

Definition at line 47 of file MaintenanceControllerTest.php.


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