4 require_once
'Services/WorkflowEngine/test/ilWorkflowEngineBaseTest.php';
15 public $base_path =
'./Services/WorkflowEngine/test/parser/';
20 return $this->base_path . $this->suite_path . $test_name .
'.bpmn2';
25 return $this->base_path . $this->suite_path . $test_name .
'_output.php';
30 return $this->base_path . $this->suite_path . $test_name .
'_goldsample.php';
35 chdir(dirname(__FILE__));
36 chdir(
'../../../../../');
40 require_once
'./Services/WorkflowEngine/classes/parser/class.ilBPMN2Parser.php';
43 public function test_WorkflowWithSimpleTaskShouldOutputAccordingly()
45 $test_name =
'Task_Simple';
53 $this->assertTrue(substr($return, 0, 25) ==
'No syntax errors detected',
'Lint of output code failed.');
56 $this->assertEquals($goldsample,
$parse_result,
'Output does not match goldsample.');
59 $process =
new $test_name;
60 $this->assertFalse($process->isActive());
62 $process->startWorkflow();
63 $all_triggered =
true;
64 foreach ($process->getNodes() as $node) {
66 foreach ($node->getDetectors() as $detector) {
68 if (!$detector->getActivated()) {
69 $all_triggered =
false;
72 foreach ($node->getEmitters() as $emitter) {
74 if (!$emitter->getActivated()) {
75 $all_triggered =
false;
79 $this->assertTrue($all_triggered);
83 public function test_WorkflowWithSimpleCallActivityShouldOutputAccordingly()
85 $test_name =
'Task_CallActivity_Simple';
93 $this->assertTrue(substr($return, 0, 25) ==
'No syntax errors detected',
'Lint of output code failed.');
96 $this->assertEquals($goldsample,
$parse_result,
'Output does not match goldsample.');
99 $process =
new $test_name;
100 self::$wasTriggered =
false;
101 $process->startWorkflow();
102 $all_triggered =
true;
103 foreach ($process->getNodes() as $node) {
105 foreach ($node->getDetectors() as $detector) {
107 if (!$detector->getActivated()) {
108 $all_triggered =
false;
111 foreach ($node->getEmitters() as $emitter) {
113 if (!$emitter->getActivated()) {
114 $all_triggered =
false;
118 $this->assertTrue($all_triggered,
'Not all nodes were triggered.');
119 $this->assertTrue(self::$wasTriggered,
'Static method call was not called.');
127 self::$wasTriggered =
true;
130 public function test_WorkflowWithManualTaskShouldOutputAccordingly()
132 $test_name =
'Task_ManualTask_Simple';
140 $this->assertTrue(substr($return, 0, 25) ==
'No syntax errors detected',
'Lint of output code failed.');
143 $this->assertEquals($goldsample,
$parse_result,
'Output does not match goldsample.');
146 $process =
new $test_name;
147 $process->startWorkflow();
148 $all_triggered =
true;
149 foreach ($process->getNodes() as $node) {
151 foreach ($node->getDetectors() as $detector) {
153 if (!$detector->getActivated()) {
154 $all_triggered =
false;
157 foreach ($node->getEmitters() as $emitter) {
159 if (!$emitter->getActivated()) {
160 $all_triggered =
false;
164 $this->assertTrue($all_triggered);
169 public function test_WorkflowWithScriptTaskShouldOutputAccordingly()
171 $test_name =
'Task_ScriptTask_Simple';
179 $this->assertTrue(substr($return, 0, 25) ==
'No syntax errors detected',
'Lint of output code failed.');
182 $this->assertEquals($goldsample,
$parse_result,
'Output does not match goldsample.');
185 self::$wasTriggered =
false;
186 $process =
new $test_name;
187 $process->startWorkflow();
188 $all_triggered =
true;
189 foreach ($process->getNodes() as $node) {
191 foreach ($node->getDetectors() as $detector) {
193 if (!$detector->getActivated()) {
194 $all_triggered =
false;
197 foreach ($node->getEmitters() as $emitter) {
199 if (!$emitter->getActivated()) {
200 $all_triggered =
false;
204 $this->assertTrue($all_triggered,
'Not all nodes were triggered.');
205 $this->assertTrue(self::$wasTriggered,
'Static method call was not called.');
216 self::$wasListRequestTriggered =
true;
218 return array(
'DataObjectReference_1' => self::$retval);
221 public function test_ReadLearnersFromCourseShouldOutputAccordingly()
223 $test_name =
'Task_ReadLearnersFromCourse';
231 $this->assertTrue(substr($return, 0, 25) ==
'No syntax errors detected',
'Lint of output code failed.');
234 $this->assertEquals($goldsample,
$parse_result,
'Output does not match goldsample.');
237 self::$wasListRequestTriggered =
false;
238 $process =
new $test_name;
240 $process->setInstanceVarById(
'DataInput_1', 123456789);
241 $this->assertEquals(123456789, $process->getInstanceVarById(
'DataInput_1'));
242 $process->startWorkflow();
243 $all_triggered =
true;
244 foreach ($process->getNodes() as $node) {
246 foreach ($node->getDetectors() as $detector) {
248 if (!$detector->getActivated()) {
249 $all_triggered =
false;
252 foreach ($node->getEmitters() as $emitter) {
254 if (!$emitter->getActivated()) {
255 $all_triggered =
false;
259 $this->assertTrue($all_triggered,
'Not all nodes were triggered.');
260 $this->assertTrue(self::$wasListRequestTriggered,
'Static method call was not called.');
261 $this->assertEquals(self::$retval, $process->getInstanceVarById(
'DataObject_1'));
Class ilWorkflowEngineBaseTest.
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)