FOSSology  4.7.1
Open Source License Compliance by Open Source Software
DeciderAgentPluginTest Class Reference

Test for class DeciderAgentPlugin, covering the malformed-request guards on scheduleAgent(), addScannerDependencies() and getLicenseTypeConf() (deciderRules/agents/licenseTypeConc arriving as a scalar instead of an array throws a TypeError before the fix). More...

Inheritance diagram for DeciderAgentPluginTest:
Inheritance graph
Collaboration diagram for DeciderAgentPluginTest:
Collaboration graph

Public Member Functions

 testScheduleAgentToleratesScalarDeciderRules ()
 
 testScheduleAgentToleratesScalarAgents ()
 
 testScheduleAgentToleratesBothScalarParams ()
 
 testScheduleAgentStillReturnsZeroForEmptyArrays ()
 
 testAddScannerDependenciesToleratesScalarAgents ()
 
 testAddScannerDependenciesStillAddsFromWellFormedArray ()
 
 testAddScannerDependenciesChecksFlagSurvivesScalarAgents ()
 
 testGetLicenseTypeConfToleratesArrayParam ()
 
 testGetLicenseTypeConfStillReturnsValidType ()
 
 testGetLicenseTypeConfRejectsUnknownType ()
 

Protected Member Functions

 setUp ()
 

Private Attributes

 $plugin
 

Detailed Description

Test for class DeciderAgentPlugin, covering the malformed-request guards on scheduleAgent(), addScannerDependencies() and getLicenseTypeConf() (deciderRules/agents/licenseTypeConc arriving as a scalar instead of an array throws a TypeError before the fix).

Definition at line 23 of file DeciderAgentPluginTest.php.

Member Function Documentation

◆ testAddScannerDependenciesChecksFlagSurvivesScalarAgents()

DeciderAgentPluginTest::testAddScannerDependenciesChecksFlagSurvivesScalarAgents ( )
Test:
  1. Check_agent_monk=1 is set directly, agents[] is scalar.
  2. Verify the Check_agent_* path still works even though the agents[] fallback is malformed.

Definition at line 139 of file DeciderAgentPluginTest.php.

◆ testAddScannerDependenciesStillAddsFromWellFormedArray()

DeciderAgentPluginTest::testAddScannerDependenciesStillAddsFromWellFormedArray ( )
Test:
  1. agents is a well-formed array containing agent_nomos.
  2. Verify it is still added as a dependency (regression guard).

Definition at line 121 of file DeciderAgentPluginTest.php.

◆ testAddScannerDependenciesToleratesScalarAgents()

DeciderAgentPluginTest::testAddScannerDependenciesToleratesScalarAgents ( )
Test:
  1. agents arrives as a scalar string instead of an array.
  2. Verify addScannerDependencies() leaves $dependencies untouched instead of throwing, when no Check_agent_* flags are set either.

Definition at line 104 of file DeciderAgentPluginTest.php.

◆ testGetLicenseTypeConfRejectsUnknownType()

DeciderAgentPluginTest::testGetLicenseTypeConfRejectsUnknownType ( )
Test:
  1. licenseTypeConc is a well-formed string NOT in the configured list.
  2. Verify "" is returned (regression guard).

Definition at line 195 of file DeciderAgentPluginTest.php.

◆ testGetLicenseTypeConfStillReturnsValidType()

DeciderAgentPluginTest::testGetLicenseTypeConfStillReturnsValidType ( )
Test:
  1. licenseTypeConc is a well-formed string matching a configured type.
  2. Verify it is still returned (regression guard).

Definition at line 176 of file DeciderAgentPluginTest.php.

◆ testGetLicenseTypeConfToleratesArrayParam()

DeciderAgentPluginTest::testGetLicenseTypeConfToleratesArrayParam ( )
Test:
  1. licenseTypeConc arrives as an array instead of a string (e.g. ?licenseTypeConc[]=x on the query string).
  2. Verify getLicenseTypeConf() returns "" instead of throwing.

Definition at line 157 of file DeciderAgentPluginTest.php.

◆ testScheduleAgentStillReturnsZeroForEmptyArrays()

DeciderAgentPluginTest::testScheduleAgentStillReturnsZeroForEmptyArrays ( )
Test:
  1. Well-formed empty arrays (the normal "nothing selected" case).
  2. Verify scheduleAgent() still returns 0 (regression guard: the fix must not change behavior for well-formed requests).

Definition at line 88 of file DeciderAgentPluginTest.php.

◆ testScheduleAgentToleratesBothScalarParams()

DeciderAgentPluginTest::testScheduleAgentToleratesBothScalarParams ( )
Test:
  1. Both deciderRules and agents malformed at once.
  2. Verify scheduleAgent() returns 0 instead of throwing.

Definition at line 72 of file DeciderAgentPluginTest.php.

◆ testScheduleAgentToleratesScalarAgents()

DeciderAgentPluginTest::testScheduleAgentToleratesScalarAgents ( )
Test:
  1. agents arrives as a scalar string instead of an array.
  2. Verify scheduleAgent() returns 0 instead of throwing.

Definition at line 57 of file DeciderAgentPluginTest.php.

◆ testScheduleAgentToleratesScalarDeciderRules()

DeciderAgentPluginTest::testScheduleAgentToleratesScalarDeciderRules ( )
Test:
  1. deciderRules arrives as a scalar string instead of an array (e.g. ?deciderRules=x on the query string).
  2. Verify scheduleAgent() returns 0 instead of throwing.

Definition at line 42 of file DeciderAgentPluginTest.php.


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