22 include_once(
"./Services/PHPUnit/classes/class.ilUnitUtil.php");
26 require_once
'./Services/WorkflowEngine/classes/workflows/class.ilEmptyWorkflow.php';
33 if ($ilSetting != NULL)
35 $ilSetting->delete(
'IL_PHPUNIT_TEST_TIME');
36 $ilSetting->delete(
'IL_PHPUNIT_TEST_MICROTIME');
49 'Construction failed with valid context passed to constructor.' 59 $actual = $node->getContext();
62 if ($actual === $this->workflow)
64 $this->assertEquals($actual, $this->workflow);
66 $this->assertTrue(
false,
'Context not identical.');
74 require_once
'./Services/WorkflowEngine/classes/detectors/class.ilSimpleDetector.php';
76 $node->addDetector($detector);
82 $actual = $node->isActive();
83 $this->assertTrue($actual);
90 require_once
'./Services/WorkflowEngine/classes/detectors/class.ilSimpleDetector.php';
92 $node->addDetector($detector);
96 $was_activated = $node->isActive();
98 $was_deactivated = !$node->isActive();
101 $this->assertEquals($was_activated, $was_deactivated);
108 require_once
'./Services/WorkflowEngine/classes/detectors/class.ilSimpleDetector.php';
110 $node->addDetector($detector1);
112 $node->addDetector($detector2);
114 $detector1->trigger(null);
115 $detector2->trigger(null);
118 $preconditions = $node->checkTransitionPreconditions();
121 $this->assertTrue($preconditions);
128 require_once
'./Services/WorkflowEngine/classes/detectors/class.ilSimpleDetector.php';
130 $node->addDetector($detector1);
132 $node->addDetector($detector2);
133 $node->setIsExclusiveJoin(
true);
134 $detector1->trigger(null);
135 $detector2->trigger(null);
138 $preconditions = $node->checkTransitionPreconditions();
141 $this->assertTrue($preconditions);
148 require_once
'./Services/WorkflowEngine/classes/detectors/class.ilSimpleDetector.php';
150 $node->addDetector($detector1);
152 $node->addDetector($detector2);
156 $this->assertTrue($node->isActive());
157 $detector1->trigger(null);
158 $detector2->trigger(null);
160 $this->assertFalse($node->isActive());
167 require_once
'./Services/WorkflowEngine/classes/detectors/class.ilSimpleDetector.php';
169 $node->addDetector($detector1);
171 $node->addDetector($detector2);
173 $detector1->trigger(null);
177 $preconditions = $node->checkTransitionPreconditions();
180 $this->assertFalse($preconditions);
187 require_once
'./Services/WorkflowEngine/classes/detectors/class.ilSimpleDetector.php';
189 $node->addDetector($detector1);
191 $node->addDetector($detector2);
192 $node->setIsExclusiveJoin(
true);
193 $detector1->trigger(null);
194 $detector2->trigger(null);
197 $success = $node->attemptTransition();
207 require_once
'./Services/WorkflowEngine/classes/detectors/class.ilSimpleDetector.php';
209 $node->addDetector($detector);
213 $node->executeTransition();
214 $state = $node->isActive();
217 $this->assertFalse($state);
224 require_once
'./Services/WorkflowEngine/classes/detectors/class.ilSimpleDetector.php';
226 $node->addDetector($detector);
228 $node->setIsExclusiveFork(
true);
231 $node->executeTransition();
232 $state = $node->isActive();
235 $this->assertFalse($state);
242 require_once
'./Services/WorkflowEngine/classes/detectors/class.ilSimpleDetector.php';
244 $node->addDetector($detector);
246 require_once
'./Services/WorkflowEngine/classes/activities/class.ilLoggingActivity.php';
248 $activity->setLogFile(
'ilTransitionLog.txt');
249 $activity->setLogLevel(
'MESSAGE');
250 $activity->setLogMessage(
'TEST');
251 $node->addActivity($activity);
255 $node->executeTransition();
258 $expected =
' :: MESSAGE :: TEST';
259 $fp = fopen(
'ilTransitionLog.txt', r);
261 $actual = substr($line, 25, strlen($line)-27);
262 @unlink(
'ilTransitionLog.txt');
273 require_once
'./Services/WorkflowEngine/classes/detectors/class.ilSimpleDetector.php';
275 $node->addDetector($detector);
277 require_once
'./Services/WorkflowEngine/classes/emitters/class.ilActivationEmitter.php';
280 $t_node->addDetector($t_detector);
282 $t_node->addDetector($foo_detector);
286 $emitter->setTargetDetector($t_detector);
287 $node->addEmitter($emitter);
291 $node->executeTransition();
294 $this->assertTrue($t_node->isActive());
301 require_once
'./Services/WorkflowEngine/classes/detectors/class.ilSimpleDetector.php';
303 $node->addDetector($detector);
305 require_once
'./Services/WorkflowEngine/classes/emitters/class.ilActivationEmitter.php';
308 $t_node->addDetector($t_detector);
310 $t_node->addDetector($foo_detector);
314 $emitter->setTargetDetector($t_detector);
315 $node->addEmitter($emitter);
316 $node->setIsExclusiveFork(
true);
320 $node->executeTransition();
323 $this->assertTrue($t_node->isActive());
330 require_once
'./Services/WorkflowEngine/classes/detectors/class.ilSimpleDetector.php';
334 $node->addDetector($detector);
335 $detectors = $node->getDetectors();
338 $this->assertEquals($detector, $detectors[0]);
345 require_once
'./Services/WorkflowEngine/classes/activities/class.ilLoggingActivity.php';
349 $node->addActivity( $activity );
350 $activities = $node->getActivities();
353 $this->assertEquals( $activity, $activities[0] );
testConstructorValidContext()
testNotifyDetectorSatisfactionAndTransit()
testCheckTransitionPreconditionsValid()
testIsActiveAndActivate()
testCheckTransitionPreconditionsInvalid()
testExecuteActivitiesViaExecuteTransition()
ilCaseNodeTest is part of the petri net based workflow engine.
testAttemptTransitionPreconditionsValidOnExclusiveJoin()
testExecuteEmitterViaExecuteTransitionExclusiveFork()
testExecuteTransitionExclusiveFork()
testCheckTransitionPreconditionsValidOnExclusiveJoin()
testExecuteEmitterViaExecuteTransition()