13 public $base_path =
'./Services/WorkflowEngine/test/parser/';
18 return $this->base_path . $this->suite_path . $test_name .
'.bpmn2';
23 return $this->base_path . $this->suite_path . $test_name .
'_output.php';
28 return $this->base_path . $this->suite_path . $test_name .
'_goldsample.php';
33 chdir( dirname( __FILE__ ) );
34 chdir(
'../../../../../' );
36 require_once
'./Services/WorkflowEngine/classes/parser/class.ilBPMN2Parser.php';
39 public function test_WorkflowWithSimpleTaskShouldOutputAccordingly()
41 $test_name =
'Task_Simple';
49 $this->assertTrue(substr($return,0,25) ==
'No syntax errors detected',
'Lint of output code failed.');
52 $this->assertEquals($goldsample,
$parse_result,
'Output does not match goldsample.');
55 $process =
new $test_name;
56 $this->assertFalse($process->isActive());
58 $process->startWorkflow();
59 $all_triggered =
true;
60 foreach($process->getNodes() as $node)
63 foreach($node->getDetectors() as $detector)
66 if(!$detector->getActivated())
68 $all_triggered =
false;
71 foreach($node->getEmitters() as $emitter)
74 if(!$emitter->getActivated())
76 $all_triggered =
false;
80 $this->assertTrue($all_triggered);
84 public function test_WorkflowWithSimpleCallActivityShouldOutputAccordingly()
86 $test_name =
'Task_CallActivity_Simple';
94 $this->assertTrue(substr($return,0,25) ==
'No syntax errors detected',
'Lint of output code failed.');
97 $this->assertEquals($goldsample,
$parse_result,
'Output does not match goldsample.');
100 $process =
new $test_name;
101 self::$wasTriggered =
false;
102 $process->startWorkflow();
103 $all_triggered =
true;
104 foreach($process->getNodes() as $node)
107 foreach($node->getDetectors() as $detector)
110 if(!$detector->getActivated())
112 $all_triggered =
false;
115 foreach($node->getEmitters() as $emitter)
118 if(!$emitter->getActivated())
120 $all_triggered =
false;
124 $this->assertTrue($all_triggered,
'Not all nodes were triggered.');
125 $this->assertTrue(self::$wasTriggered,
'Static method call was not called.');
133 self::$wasTriggered =
true;
136 public function test_WorkflowWithManualTaskShouldOutputAccordingly()
138 $test_name =
'Task_ManualTask_Simple';
146 $this->assertTrue(substr($return,0,25) ==
'No syntax errors detected',
'Lint of output code failed.');
149 $this->assertEquals($goldsample,
$parse_result,
'Output does not match goldsample.');
152 $process =
new $test_name;
153 $process->startWorkflow();
154 $all_triggered =
true;
155 foreach($process->getNodes() as $node)
158 foreach($node->getDetectors() as $detector)
161 if(!$detector->getActivated())
163 $all_triggered =
false;
166 foreach($node->getEmitters() as $emitter)
169 if(!$emitter->getActivated())
171 $all_triggered =
false;
175 $this->assertTrue($all_triggered);
180 public function test_WorkflowWithScriptTaskShouldOutputAccordingly()
182 $test_name =
'Task_ScriptTask_Simple';
190 $this->assertTrue(substr($return,0,25) ==
'No syntax errors detected',
'Lint of output code failed.');
193 $this->assertEquals($goldsample,
$parse_result,
'Output does not match goldsample.');
196 self::$wasTriggered =
false;
197 $process =
new $test_name;
198 $process->startWorkflow();
199 $all_triggered =
true;
200 foreach($process->getNodes() as $node)
203 foreach($node->getDetectors() as $detector)
206 if(!$detector->getActivated())
208 $all_triggered =
false;
211 foreach($node->getEmitters() as $emitter)
214 if(!$emitter->getActivated())
216 $all_triggered =
false;
220 $this->assertTrue($all_triggered,
'Not all nodes were triggered.');
221 $this->assertTrue(self::$wasTriggered,
'Static method call was not called.');
232 self::$wasListRequestTriggered =
true;
234 return array(
'DataObjectReference_1' => self::$retval);
237 public function test_ReadLearnersFromCourseShouldOutputAccordingly()
239 $test_name =
'Task_ReadLearnersFromCourse';
247 $this->assertTrue(substr($return,0,25) ==
'No syntax errors detected',
'Lint of output code failed.');
250 $this->assertEquals($goldsample,
$parse_result,
'Output does not match goldsample.');
253 self::$wasListRequestTriggered =
false;
254 $process =
new $test_name;
256 $process->setInstanceVarById(
'DataInput_1', 123456789);
257 $this->assertEquals(123456789, $process->getInstanceVarById(
'DataInput_1'));
258 $process->startWorkflow();
259 $all_triggered =
true;
260 foreach($process->getNodes() as $node)
263 foreach($node->getDetectors() as $detector)
266 if(!$detector->getActivated())
268 $all_triggered =
false;
271 foreach($node->getEmitters() as $emitter)
274 if(!$emitter->getActivated())
276 $all_triggered =
false;
280 $this->assertTrue($all_triggered,
'Not all nodes were triggered.');
281 $this->assertTrue(self::$wasListRequestTriggered,
'Static method call was not called.');
282 $this->assertEquals(self::$retval, $process->getInstanceVarById(
'DataObject_1'));
getTestGoldsampleFilename($test_name)
static triggerMe($context="", $params="")
static requestList($context, $params)
static $wasListRequestTriggered
Create styles array
The data for the language used.
getTestInputFilename($test_name)
getTestOutputFilename($test_name)