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

Test for class KotobaAgentPlugin::isAgentScheduledForUpload() More...

Inheritance diagram for KotobaAgentPluginTest:
Inheritance graph
Collaboration diagram for KotobaAgentPluginTest:
Collaboration graph

Public Member Functions

 testReturnsTrueWhenAgentHasAnUnfinishedJob ()
 
 testReturnsFalseWhenAgentHasNoJob ()
 
 testReturnsFalseWithoutDbQueryWhenPluginNotFound ()
 
 testChecksEachAgentIndependently ()
 

Protected Member Functions

 setUp ()
 
 tearDown ()
 

Private Member Functions

 registerStubPlugin ($pluginName, $agentName)
 

Private Attributes

 $assertCountBefore
 
 $plugin
 
 $dbManager
 

Detailed Description

Test for class KotobaAgentPlugin::isAgentScheduledForUpload()

Regression coverage for the scancode scheduling-race fix: this method must stay a plain "is it already queued" DB check. A request-intent shortcut was tried and reverted because dependency resolution calls AgentAdd() on whatever it finds here, so treating a not-yet-queued ParmAgent as scheduled queues it with no args instead of waiting for it.

Definition at line 27 of file KotobaAgentPluginTest.php.

Member Function Documentation

◆ registerStubPlugin()

KotobaAgentPluginTest::registerStubPlugin (   $pluginName,
  $agentName 
)
private

Register a minimal stub plugin under $pluginName with the given AgentName.

Definition at line 56 of file KotobaAgentPluginTest.php.

◆ testChecksEachAgentIndependently()

KotobaAgentPluginTest::testChecksEachAgentIndependently ( )
Test:
  1. Two different scanner agents, each independently checked.
  2. Verify each lookup uses its own AgentName and upload ID.

Definition at line 128 of file KotobaAgentPluginTest.php.

◆ testReturnsFalseWhenAgentHasNoJob()

KotobaAgentPluginTest::testReturnsFalseWhenAgentHasNoJob ( )
Test:
  1. agent_scancode is registered but has no unfinished jobqueue row.
  2. Verify isAgentScheduledForUpload() returns false. This is the exact state kotoba sees when scancode has not been queued yet at the point kotoba's dependency check runs.

Definition at line 93 of file KotobaAgentPluginTest.php.

◆ testReturnsFalseWithoutDbQueryWhenPluginNotFound()

KotobaAgentPluginTest::testReturnsFalseWithoutDbQueryWhenPluginNotFound ( )
Test:
  1. The plugin name does not resolve to any registered plugin.
  2. Verify isAgentScheduledForUpload() returns false without querying the DB at all.

Definition at line 112 of file KotobaAgentPluginTest.php.

◆ testReturnsTrueWhenAgentHasAnUnfinishedJob()

KotobaAgentPluginTest::testReturnsTrueWhenAgentHasAnUnfinishedJob ( )
Test:
  1. agent_scancode is registered and has an unfinished jobqueue row for this upload.
  2. Verify isAgentScheduledForUpload() returns true, and that the DB query uses the plugin's AgentName ("scancode"), not the plugin name ("agent_scancode").

Definition at line 70 of file KotobaAgentPluginTest.php.


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