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_WorkflowWithSimpleIntermediateMessageEventShouldOutputAccordingly()
45 $test_name =
'IntermediateCatchEvent_Message_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.');
58 $ildb_mock = $this->getMockBuilder(ilDBInterface::class)->getMock();
59 $ildb_mock->expects($this->any())->method(
'quote')->will($this->returnCallback(
''));
61 $ildb_mock->expects($this->any())->method(
'nextId')->will($this->returnValue(
$i++));
62 $ildb_mock->expects($this->any())->method(
'insert')->will($this->returnValue(
true));
70 $process =
new $test_name;
71 $process->startWorkflow();
72 $all_triggered =
true;
73 foreach ($process->getNodes() as $node) {
75 foreach ($node->getDetectors() as $detector) {
77 if (!$detector->getActivated()) {
78 $all_triggered =
false;
81 foreach ($node->getEmitters() as $emitter) {
83 if (!$emitter->getActivated()) {
84 $all_triggered =
false;
88 $this->assertFalse($all_triggered,
'All nodes were triggered (but should not since the event was not handled.');
90 $process->handleEvent(
101 $all_triggered =
true;
102 foreach ($process->getNodes() as $node) {
104 foreach ($node->getDetectors() as $detector) {
106 if (!$detector->getActivated()) {
107 $all_triggered =
false;
110 foreach ($node->getEmitters() as $emitter) {
112 if (!$emitter->getActivated()) {
113 $all_triggered =
false;
117 $this->assertTrue($all_triggered,
'Not all nodes were triggered.');
122 public function test_WorkflowWithSimpleIntermediateSignalEventShouldOutputAccordingly()
124 $test_name =
'IntermediateCatchEvent_Signal_Simple';
132 $this->assertTrue(substr($return, 0, 25) ==
'No syntax errors detected',
'Lint of output code failed.');
135 $this->assertEquals($goldsample,
$parse_result,
'Output does not match goldsample.');
137 $ildb_mock = $this->getMockBuilder(ilDBInterface::class)->getMock();
138 $ildb_mock->expects($this->any())->method(
'quote')->will($this->returnCallback(
''));
140 $ildb_mock->expects($this->any())->method(
'nextId')->will($this->returnValue(
$i++));
141 $ildb_mock->expects($this->any())->method(
'insert')->will($this->returnValue(
true));
149 $process =
new $test_name;
150 $process->startWorkflow();
151 $all_triggered =
true;
152 foreach ($process->getNodes() as $node) {
154 foreach ($node->getDetectors() as $detector) {
156 if (!$detector->getActivated()) {
157 $all_triggered =
false;
160 foreach ($node->getEmitters() as $emitter) {
162 if (!$emitter->getActivated()) {
163 $all_triggered =
false;
167 $this->assertFalse($all_triggered,
'All nodes were triggered (but should not since the event was not handled.');
169 $process->handleEvent(
180 $all_triggered =
true;
181 foreach ($process->getNodes() as $node) {
183 foreach ($node->getDetectors() as $detector) {
185 if (!$detector->getActivated()) {
186 $all_triggered =
false;
189 foreach ($node->getEmitters() as $emitter) {
191 if (!$emitter->getActivated()) {
192 $all_triggered =
false;
196 $this->assertTrue($all_triggered,
'Not all nodes were triggered.');
201 public function test_WorkflowWithSimpleIntermediateTimerEventShouldOutputAccordingly()
203 $test_name =
'IntermediateCatchEvent_Timer_Simple';
211 $this->assertTrue(substr($return, 0, 25) ==
'No syntax errors detected',
'Lint of output code failed.');
214 $this->assertEquals($goldsample,
$parse_result,
'Output does not match goldsample.');
216 $ildb_mock = $this->getMockBuilder(ilDBInterface::class)->getMock();
217 $ildb_mock->expects($this->any())->method(
'quote')->will($this->returnCallback(
''));
219 $ildb_mock->expects($this->any())->method(
'nextId')->will($this->returnValue(
$i++));
220 $ildb_mock->expects($this->any())->method(
'insert')->will($this->returnValue(
true));
228 $process =
new $test_name;
229 $process->startWorkflow();
230 $all_triggered =
true;
231 foreach ($process->getNodes() as $node) {
233 foreach ($node->getDetectors() as $detector) {
235 if (!$detector->getActivated()) {
236 $all_triggered =
false;
239 foreach ($node->getEmitters() as $emitter) {
241 if (!$emitter->getActivated()) {
242 $all_triggered =
false;
246 $this->assertFalse($all_triggered,
'All nodes were triggered (but should not since the event was not handled.');
248 $process->handleEvent(
259 $all_triggered =
true;
260 foreach ($process->getNodes() as $node) {
262 foreach ($node->getDetectors() as $detector) {
264 if (!$detector->getActivated()) {
265 $all_triggered =
false;
268 foreach ($node->getEmitters() as $emitter) {
270 if (!$emitter->getActivated()) {
271 $all_triggered =
false;
275 $this->assertTrue($all_triggered,
'Not all nodes were triggered.');
Class ilWorkflowEngineBaseTest.
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']