32 include_once(__DIR__.
'/../../../lib/php/Test/Agent/AgentTestMockHelper.php');
33 include_once(__DIR__.
'/SchedulerTestRunner.php');
35 include(dirname(dirname(__DIR__)).
'/agent/ReuserAgent.php');
84 public function run($uploadId, $userId=2, $groupId=2, $jobId=1, $args=
"")
86 $GLOBALS[
'userId'] = $userId;
87 $GLOBALS[
'jobId'] = $jobId;
88 $GLOBALS[
'groupId'] = $groupId;
92 $this->clearingEventProcessor = M::mock(LicenseRef::class);
93 $this->decisionTypes = M::mock(LicenseRef::class);
94 $this->agentLicenseEventProcessor = M::mock(LicenseRef::class);
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(
'decision.types')->andReturn($this->decisionTypes);
102 $container->shouldReceive(
'get')->with(
'businessrules.clearing_event_processor')->andReturn($this->clearingEventProcessor);
103 $container->shouldReceive(
'get')->with(
'businessrules.clearing_decision_filter')->andReturn($this->clearingDecisionFilter);
104 $container->shouldReceive(
'get')->with(
'businessrules.clearing_decision_processor')->andReturn($this->clearingDecisionProcessor);
105 $container->shouldReceive(
'get')->with(
'businessrules.agent_license_event_processor')->andReturn($this->agentLicenseEventProcessor);
106 $container->shouldReceive(
'get')->with(
'dao.tree')->andReturn($this->treeDao);
107 $GLOBALS[
'container'] = $container;
110 $fgetsMock->shouldReceive(
"fgets")->with(STDIN)->andReturn($uploadId,
false);
111 $GLOBALS[
'fgetsMock'] = $fgetsMock;
117 include(dirname(dirname(__DIR__)).
'/agent/reuser.php');
119 $output = ob_get_clean();
121 return array(
true, $output, $exitval);
Structure of an Agent with all required parameters.
Create mock objects for reuser.
$clearingDecisionProcessor
Various utility functions to filter ClearingDecision.
run($uploadId, $userId=2, $groupId=2, $jobId=1, $args="")
Function to run agent from scheduler.
Namespace used by reuser agent.
fo_dbManager * dbManager
fo_dbManager object
Namespace to hold test cases for Reuser agent.