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_WorkflowWithSimpleEndEventShouldOutputAccordingly()
45 $test_name =
'EndEvent_Blanko_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 $process->startWorkflow();
61 $all_triggered =
true;
62 foreach ($process->getNodes() as $node) {
64 foreach ($node->getDetectors() as $detector) {
66 if (!$detector->getActivated()) {
67 $all_triggered =
false;
70 foreach ($node->getEmitters() as $emitter) {
72 if (!$emitter->getActivated()) {
73 $all_triggered =
false;
77 $this->assertTrue($all_triggered,
'Not all nodes were triggered.');
82 public function test_WorkflowWithSignalEndEventShouldOutputAccordingly()
84 $test_name =
'EndEvent_Signal_Simple';
92 $this->assertTrue(substr($return, 0, 25) ==
'No syntax errors detected',
'Lint of output code failed.');
95 $this->assertEquals($goldsample,
$parse_result,
'Output does not match goldsample.');
97 $ilappeventhandler_mock = $this->createMock(
'ilAppEventHandler',
array(
'raise'),
array(),
'',
false,
false);
98 $ilappeventhandler_mock
99 ->expects($this->once())
101 ->will($this->returnValue(
true));
104 global $ilAppEventHandler;
105 $ilAppEventHandler = $ilappeventhandler_mock;
106 $GLOBALS[
'ilAppEventHandler'] = $ilappeventhandler_mock;
109 $process =
new $test_name;
110 $process->startWorkflow();
111 $all_triggered =
true;
112 foreach ($process->getNodes() as $node) {
114 foreach ($node->getDetectors() as $detector) {
116 if (!$detector->getActivated()) {
117 $all_triggered =
false;
120 foreach ($node->getEmitters() as $emitter) {
122 if (!$emitter->getActivated()) {
123 $all_triggered =
false;
127 $this->assertTrue($all_triggered,
'Not all nodes were triggered.');
132 public function test_WorkflowWithMessageEndEventShouldOutputAccordingly()
134 $test_name =
'EndEvent_Message_Simple';
142 $this->assertTrue(substr($return, 0, 25) ==
'No syntax errors detected',
'Lint of output code failed.');
145 $this->assertEquals($goldsample,
$parse_result,
'Output does not match goldsample.');
147 $ilappeventhandler_mock = $this->createMock(
'ilAppEventHandler',
array(
'raise'),
array(),
'',
false,
false);
148 $ilappeventhandler_mock
149 ->expects($this->once())
151 ->will($this->returnValue(
true));
154 global $ilAppEventHandler;
155 $ilAppEventHandler = $ilappeventhandler_mock;
156 $GLOBALS[
'ilAppEventHandler'] = $ilappeventhandler_mock;
159 $process =
new $test_name;
160 $process->startWorkflow();
161 $all_triggered =
true;
162 foreach ($process->getNodes() as $node) {
164 foreach ($node->getDetectors() as $detector) {
166 if (!$detector->getActivated()) {
167 $all_triggered =
false;
170 foreach ($node->getEmitters() as $emitter) {
172 if (!$emitter->getActivated()) {
173 $all_triggered =
false;
177 $this->assertTrue($all_triggered,
'Not all nodes were triggered.');
182 public function test_WorkflowWithTerminateEndEventShouldOutputAccordingly()
184 $test_name =
'EndEvent_Terminate_Simple';
192 $this->assertTrue(substr($return, 0, 25) ==
'No syntax errors detected',
'Lint of output code failed.');
195 $this->assertEquals($goldsample,
$parse_result,
'Output does not match goldsample.');
198 $process =
new $test_name;
199 $process->startWorkflow();
200 $all_triggered =
true;
201 foreach ($process->getNodes() as $node) {
203 foreach ($node->getDetectors() as $detector) {
205 if (!$detector->getActivated()) {
206 $all_triggered =
false;
209 foreach ($node->getEmitters() as $emitter) {
211 if (!$emitter->getActivated()) {
212 $all_triggered =
false;
216 $this->assertTrue($all_triggered,
'Not all nodes were triggered.');
Class ilWorkflowEngineBaseTest.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
Create styles array
The data for the language used.
getTestInputFilename($test_name)
getTestOutputFilename($test_name)
getTestGoldsampleFilename($test_name)