4 require_once
'Services/WorkflowEngine/test/ilWorkflowEngineBaseTest.php';
17 public $base_path =
'./Services/WorkflowEngine/test/parser/';
22 return $this->base_path . $this->suite_path . $test_name .
'.bpmn2';
27 return $this->base_path . $this->suite_path . $test_name .
'_output.php';
32 return $this->base_path . $this->suite_path . $test_name .
'_goldsample.php';
37 chdir(dirname(__FILE__));
38 chdir(
'../../../../../');
42 require_once
'./Services/WorkflowEngine/classes/parser/class.ilBPMN2Parser.php';
45 public function test_WorkflowWithExclusiveGatewayForkingShouldOutputAccordingly()
47 $test_name =
'ExclusiveGateway_Fork_Simple';
55 $this->assertTrue(substr($return, 0, 25) ==
'No syntax errors detected',
'Lint of output code failed.');
58 $this->assertEquals($goldsample,
$parse_result,
'Output does not match goldsample.');
61 $process =
new $test_name;
62 $this->assertFalse($process->isActive(),
'Process is not active.');
64 $process->startWorkflow();
65 $all_triggered =
true;
66 foreach ($process->getNodes() as $node) {
68 foreach ($node->getDetectors() as $detector) {
70 if (!$detector->getActivated()) {
71 $all_triggered =
false;
74 foreach ($node->getEmitters() as $emitter) {
76 if (!$emitter->getActivated()) {
77 $all_triggered =
false;
81 $this->assertFalse($all_triggered,
'All nodes were triggered.');
84 foreach ($process->getNodes() as $node) {
85 if ($node->isActive()) {
86 $all_inactive =
false;
89 $this->assertFalse($all_inactive,
'Not all nodes are inactive.');
96 public function test_WorkflowWithExclusiveGatewayJoiningShouldOutputAccordingly()
98 $test_name =
'ExclusiveGateway_Join_Simple';
106 $this->assertTrue(substr($return, 0, 25) ==
'No syntax errors detected',
'Lint of output code failed.');
109 $this->assertEquals($goldsample,
$parse_result,
'Output does not match goldsample.');
112 $process =
new $test_name;
113 $this->assertFalse($process->isActive(),
'Process is inactive.');
115 $process->startWorkflow();
116 $all_triggered =
true;
117 foreach ($process->getNodes() as $node) {
119 foreach ($node->getDetectors() as $detector) {
121 if (!$detector->getActivated()) {
122 $all_triggered =
false;
125 foreach ($node->getEmitters() as $emitter) {
127 if (!$emitter->getActivated()) {
128 $all_triggered =
false;
132 $this->assertTrue($all_triggered,
'Not all nodes were triggered.');
134 $all_inactive =
true;
135 foreach ($process->getNodes() as $node) {
136 if ($node->isActive()) {
137 $all_inactive =
false;
140 $this->assertTrue($all_inactive,
'Not all nodes are inactive.');
Class ilWorkflowEngineBaseTest.
getTestGoldsampleFilename($test_name)
getTestOutputFilename($test_name)
getTestInputFilename($test_name)