19 include_once(
"./Services/PHPUnit/classes/class.ilUnitUtil.php");
23 require_once
'./Services/WorkflowEngine/classes/workflows/class.ilEmptyWorkflow.php';
30 if ($ilSetting != null) {
31 $ilSetting->delete(
'IL_PHPUNIT_TEST_TIME');
32 $ilSetting->delete(
'IL_PHPUNIT_TEST_MICROTIME');
45 'Construction failed with valid context passed to constructor.' 55 $actual = $node->getContext();
58 if ($actual === $this->workflow) {
59 $this->assertEquals($actual, $this->workflow);
61 $this->assertTrue(
false,
'Context not identical.');
69 require_once
'./Services/WorkflowEngine/classes/detectors/class.ilSimpleDetector.php';
71 $node->addDetector($detector);
72 $evaluation_expression =
'return null;';
73 $node->setEvaluationExpression($evaluation_expression);
79 $actual = $node->isActive();
80 $this->assertTrue($actual);
87 require_once
'./Services/WorkflowEngine/classes/detectors/class.ilSimpleDetector.php';
89 $node->addDetector($detector);
90 $evaluation_expression =
'return null;';
91 $node->setEvaluationExpression($evaluation_expression);
95 $was_activated = $node->isActive();
97 $was_deactivated = !$node->isActive();
100 $this->assertEquals($was_activated, $was_deactivated);
107 require_once
'./Services/WorkflowEngine/classes/detectors/class.ilSimpleDetector.php';
109 $node->addDetector($detector1);
111 $node->addDetector($detector2);
113 $evaluation_expression =
116 if ($detectors[0]->getDetectorState() == false 117 && $detectors[1]->getDetectorState() == true) 122 if ($detectors[0]->getDetectorState() == true 123 && $detectors[1]->getDetectorState() == false) 130 $node->setEvaluationExpression($evaluation_expression);
131 $detector1->trigger(null);
134 $preconditions = $node->checkTransitionPreconditions();
137 $this->assertTrue($preconditions);
144 require_once
'./Services/WorkflowEngine/classes/detectors/class.ilSimpleDetector.php';
146 $node->addDetector($detector1);
148 $node->addDetector($detector2);
150 $evaluation_expression =
153 if ($detectors[0]->getDetectorState() == false 154 && $detectors[1]->getDetectorState() == true) 159 if ($detectors[0]->getDetectorState() == true 160 && $detectors[1]->getDetectorState() == false) 167 $node->setEvaluationExpression($evaluation_expression);
168 $detector2->trigger(null);
171 $preconditions = $node->checkTransitionPreconditions();
174 $this->assertTrue($preconditions);
181 require_once
'./Services/WorkflowEngine/classes/detectors/class.ilSimpleDetector.php';
183 $node->addDetector($detector1);
185 $node->addDetector($detector2);
187 $evaluation_expression =
190 if ($detectors[0]->getDetectorState() == false 191 && $detectors[1]->getDetectorState() == true) 196 if ($detectors[0]->getDetectorState() == true 197 && $detectors[1]->getDetectorState() == false) 204 $node->setEvaluationExpression($evaluation_expression);
207 $preconditions = $node->checkTransitionPreconditions();
210 $this->assertFalse($preconditions);
217 require_once
'./Services/WorkflowEngine/classes/detectors/class.ilSimpleDetector.php';
219 $node->addDetector($detector);
223 $node->executeTransition();
224 $state = $node->isActive();
227 $this->assertFalse(
$state);
236 require_once
'./Services/WorkflowEngine/classes/detectors/class.ilSimpleDetector.php';
238 $node->addDetector($detector);
242 $node->executeElseTransition();
243 $state = $node->isActive();
246 $this->assertFalse(
$state);
253 require_once
'./Services/WorkflowEngine/classes/detectors/class.ilSimpleDetector.php';
255 $node->addDetector($detector);
257 require_once
'./Services/WorkflowEngine/classes/activities/class.ilLoggingActivity.php';
259 $activity->setLogFile(
'ilTransitionLog.txt');
260 $activity->setLogLevel(
'MESSAGE');
261 $activity->setLogMessage(
'TEST');
262 $node->addActivity($activity);
266 $node->executeTransition();
269 $expected =
' :: MESSAGE :: TEST';
270 $fp = fopen(
'ilTransitionLog.txt',
'r');
272 $actual = substr($line, 25, strlen($line)-27);
273 @unlink(
'ilTransitionLog.txt');
284 require_once
'./Services/WorkflowEngine/classes/detectors/class.ilSimpleDetector.php';
286 $node->addDetector($detector);
288 require_once
'./Services/WorkflowEngine/classes/activities/class.ilLoggingActivity.php';
290 $activity->setLogFile(
'ilTransitionLog.txt');
291 $activity->setLogLevel(
'MESSAGE');
292 $activity->setLogMessage(
'TEST');
293 $node->addActivity($activity,
true);
297 $node->executeElseTransition();
300 $expected =
' :: MESSAGE :: TEST';
301 $fp = fopen(
'ilTransitionLog.txt',
'r');
303 $actual = substr($line, 25, strlen($line)-27);
304 @unlink(
'ilTransitionLog.txt');
315 require_once
'./Services/WorkflowEngine/classes/detectors/class.ilSimpleDetector.php';
317 $node->addDetector($detector);
319 require_once
'./Services/WorkflowEngine/classes/emitters/class.ilActivationEmitter.php';
322 $t_node->addDetector($t_detector);
324 $t_node->addDetector($foo_detector);
328 $emitter->setTargetDetector($t_detector);
329 $node->addEmitter($emitter);
333 $node->executeTransition();
336 $this->assertTrue($t_node->isActive());
343 require_once
'./Services/WorkflowEngine/classes/detectors/class.ilSimpleDetector.php';
345 $node->addDetector($detector);
347 require_once
'./Services/WorkflowEngine/classes/emitters/class.ilActivationEmitter.php';
350 $t_node->addDetector($t_detector);
352 $t_node->addDetector($foo_detector);
356 $emitter->setTargetDetector($t_detector);
357 $node->addEmitter($emitter,
true);
361 $node->executeElseTransition();
364 $this->assertTrue($t_node->isActive());
371 require_once
'./Services/WorkflowEngine/classes/detectors/class.ilSimpleDetector.php';
373 $node->addDetector($detector);
375 require_once
'./Services/WorkflowEngine/classes/emitters/class.ilActivationEmitter.php';
378 $t_node->addDetector($t_detector);
380 $t_node->addDetector($foo_detector);
384 $emitter->setTargetDetector($t_detector);
385 $node->addEmitter($emitter,
true);
386 $node->setEvaluationExpression(
"return false;");
389 $node->AttemptTransition();
392 $this->assertTrue($t_node->isActive());
399 require_once
'./Services/WorkflowEngine/classes/detectors/class.ilSimpleDetector.php';
403 $node->addDetector($detector);
404 $detectors = $node->getDetectors();
407 $this->assertEquals($detector, $detectors[0]);
414 require_once
'./Services/WorkflowEngine/classes/emitters/class.ilSimpleEmitter.php';
418 $node->addEmitter($emitter);
419 $emitters = $node->getEmitters();
422 $this->assertEquals($emitter, $emitters[0]);
429 require_once
'./Services/WorkflowEngine/classes/emitters/class.ilSimpleEmitter.php';
433 $node->addEmitter($emitter,
true);
434 $emitters = $node->getEmitters(
true);
437 $this->assertEquals($emitter, $emitters[0]);
444 require_once
'./Services/WorkflowEngine/classes/activities/class.ilLoggingActivity.php';
448 $node->addActivity($activity);
449 $activities = $node->getActivities();
452 $this->assertEquals($activity, $activities[0]);
459 require_once
'./Services/WorkflowEngine/classes/activities/class.ilLoggingActivity.php';
463 $node->addActivity($activity,
true);
464 $activities = $node->getActivities(
true);
467 $this->assertEquals($activity, $activities[0]);
475 require_once
'./Services/WorkflowEngine/classes/detectors/class.ilSimpleDetector.php';
477 $node->addDetector($detector);
478 $detector->setDetectorState(
true);
479 $node->setEvaluationExpression(
'return true;');
490 $node->notifyDetectorSatisfaction($detector);
493 $this->assertFalse($node->isActive());
500 require_once
'./Services/WorkflowEngine/classes/detectors/class.ilSimpleDetector.php';
502 $node->addDetector($detector1);
504 $node->addDetector($detector2);
505 $node->setEvaluationExpression(
'return $GLOBALS["expr_retval"];');
510 $this->assertTrue($node->isActive());
513 $detector1->trigger(null);
514 $detector2->trigger(null);
516 $this->assertFalse($node->isActive());
testExecuteTransitionThen()
testExecuteTransitionElse()
testCheckTransitionPreconditionsValidElse()
ilConditionalNodeTest is part of the petri net based workflow engine.
testNotifyDetectorSatisfactionAndTransit()
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
testExecuteElseActivitiesViaExecuteTransition()
testAddElseActivityFirst()
testCheckTransitionPreconditionsValidThen()
testExecuteEmitterViaExecuteTransition()
testConstructorValidContext()
if(!array_key_exists('stateid', $_REQUEST)) $state
Handle linkback() response from LinkedIn.
testNotifyDetectorSatisfaction()
testExecuteActivitiesViaExecuteTransition()
testExecuteElseEmitterViaAttemptTransition()
testIsActiveAndActivate()
testExecuteElseEmitterViaExecuteTransition()
testCheckTransitionPreconditionsInvalid()
testAddElseEmitterFirst()