31 include_once(__DIR__.
'/../../../lib/php/Test/Agent/AgentTestMockHelper.php');
32 include_once(__DIR__.
'/SchedulerTestRunner.php');
34 include_once(dirname(dirname(__DIR__)).
'/agent/DeciderJobAgent.php');
47 private $clearingDecisionProcessor;
49 private $agentLicenseEventProcessor;
55 private $decisionTypes;
57 private $highlightDao;
62 $this->clearingDao = $clearingDao;
63 $this->agentDao = $agentDao;
64 $this->uploadDao = $uploadDao;
65 $this->highlightDao = $highlightDao;
68 $this->clearingDecisionProcessor = $clearingDecisionProcessor;
69 $this->agentLicenseEventProcessor = $agentLicenseEventProcessor;
81 public function run($uploadId, $userId=2, $groupId=2, $jobId=1, $args=
"")
83 $GLOBALS[
'userId'] = $userId;
84 $GLOBALS[
'jobId'] = $jobId;
85 $GLOBALS[
'groupId'] = $groupId;
90 if (preg_match(
"/-k([0-9]*)/", $args, $matches)) {
91 $opts[
'k'] = $matches[1];
94 $GLOBALS[
'extraOpts'] = $opts;
96 $container = M::mock(
'Container');
97 $container->shouldReceive(
'get')->with(
'db.manager')->andReturn($this->
dbManager);
98 $container->shouldReceive(
'get')->with(
'dao.agent')->andReturn($this->agentDao);
99 $container->shouldReceive(
'get')->with(
'dao.clearing')->andReturn($this->clearingDao);
100 $container->shouldReceive(
'get')->with(
'dao.upload')->andReturn($this->uploadDao);
101 $container->shouldReceive(
'get')->with(
'dao.highlight')->andReturn($this->highlightDao);
102 $container->shouldReceive(
'get')->with(
'decision.types')->andReturn($this->decisionTypes);
103 $container->shouldReceive(
'get')->with(
'businessrules.clearing_decision_processor')->andReturn($this->clearingDecisionProcessor);
104 $container->shouldReceive(
'get')->with(
'businessrules.agent_license_event_processor')->andReturn($this->agentLicenseEventProcessor);
105 $GLOBALS[
'container'] = $container;
108 $fgetsMock->shouldReceive(
"fgets")->with(STDIN)->andReturn($uploadId,
false);
109 $GLOBALS[
'fgetsMock'] = $fgetsMock;
115 include(dirname(dirname(__DIR__)).
'/agent/deciderjob.php');
117 $output = ob_get_clean();
119 return array(
true, $output, $exitval);
Namespace for decider job test cases.
Interface for scheduler. Called by test case.
Structure of an Agent with all required parameters.
Utility functions to process ClearingDecision.
run($uploadId, $userId=2, $groupId=2, $jobId=1, $args="")
Mock as agent was called from scheduler.
Handle events related to license findings.
Namespace used by reuser agent.
fo_dbManager * dbManager
fo_dbManager object
Mock for scheduler inputs.