ilConditionalNodeTest is part of the petri net based workflow engine.
More...
ilConditionalNodeTest is part of the petri net based workflow engine.
This class holds all tests for the class nodes/class.ilConditionalNode
- Author
- Maximilian Becker mbeck.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de
- Version
- $Id$
/
Definition at line 15 of file ilConditionalNodeTest.php.
◆ setUp()
ilConditionalNodeTest::setUp |
( |
| ) |
|
Definition at line 17 of file ilConditionalNodeTest.php.
19 include_once(
"./Services/PHPUnit/classes/class.ilUnitUtil.php");
23 require_once
'./Services/WorkflowEngine/classes/workflows/class.ilEmptyWorkflow.php';
◆ tearDown()
ilConditionalNodeTest::tearDown |
( |
| ) |
|
Definition at line 27 of file ilConditionalNodeTest.php.
References $ilSetting.
30 if ($ilSetting != null) {
31 $ilSetting->delete(
'IL_PHPUNIT_TEST_TIME');
32 $ilSetting->delete(
'IL_PHPUNIT_TEST_MICROTIME');
◆ testAddActivityFirst()
ilConditionalNodeTest::testAddActivityFirst |
( |
| ) |
|
Definition at line 440 of file ilConditionalNodeTest.php.
444 require_once
'./Services/WorkflowEngine/classes/activities/class.ilLoggingActivity.php';
448 $node->addActivity($activity);
449 $activities = $node->getActivities();
452 $this->assertEquals($activity, $activities[0]);
◆ testAddDetectorFirst()
ilConditionalNodeTest::testAddDetectorFirst |
( |
| ) |
|
Definition at line 395 of file ilConditionalNodeTest.php.
399 require_once
'./Services/WorkflowEngine/classes/detectors/class.ilSimpleDetector.php';
403 $node->addDetector($detector);
404 $detectors = $node->getDetectors();
407 $this->assertEquals($detector, $detectors[0]);
◆ testAddElseActivityFirst()
ilConditionalNodeTest::testAddElseActivityFirst |
( |
| ) |
|
Definition at line 455 of file ilConditionalNodeTest.php.
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]);
◆ testAddElseEmitterFirst()
ilConditionalNodeTest::testAddElseEmitterFirst |
( |
| ) |
|
Definition at line 425 of file ilConditionalNodeTest.php.
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]);
◆ testAddEmitterFirst()
ilConditionalNodeTest::testAddEmitterFirst |
( |
| ) |
|
Definition at line 410 of file ilConditionalNodeTest.php.
414 require_once
'./Services/WorkflowEngine/classes/emitters/class.ilSimpleEmitter.php';
418 $node->addEmitter($emitter);
419 $emitters = $node->getEmitters();
422 $this->assertEquals($emitter, $emitters[0]);
◆ testCheckTransitionPreconditionsInvalid()
ilConditionalNodeTest::testCheckTransitionPreconditionsInvalid |
( |
| ) |
|
Definition at line 177 of file ilConditionalNodeTest.php.
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);
◆ testCheckTransitionPreconditionsValidElse()
ilConditionalNodeTest::testCheckTransitionPreconditionsValidElse |
( |
| ) |
|
Definition at line 140 of file ilConditionalNodeTest.php.
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);
◆ testCheckTransitionPreconditionsValidThen()
ilConditionalNodeTest::testCheckTransitionPreconditionsValidThen |
( |
| ) |
|
Definition at line 103 of file ilConditionalNodeTest.php.
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);
◆ testConstructorValidContext()
ilConditionalNodeTest::testConstructorValidContext |
( |
| ) |
|
◆ testDeactivate()
ilConditionalNodeTest::testDeactivate |
( |
| ) |
|
Definition at line 83 of file ilConditionalNodeTest.php.
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);
◆ testExecuteActivitiesViaExecuteTransition()
ilConditionalNodeTest::testExecuteActivitiesViaExecuteTransition |
( |
| ) |
|
Definition at line 249 of file ilConditionalNodeTest.php.
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');
◆ testExecuteElseActivitiesViaExecuteTransition()
ilConditionalNodeTest::testExecuteElseActivitiesViaExecuteTransition |
( |
| ) |
|
Definition at line 280 of file ilConditionalNodeTest.php.
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');
◆ testExecuteElseEmitterViaAttemptTransition()
ilConditionalNodeTest::testExecuteElseEmitterViaAttemptTransition |
( |
| ) |
|
Definition at line 367 of file ilConditionalNodeTest.php.
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());
◆ testExecuteElseEmitterViaExecuteTransition()
ilConditionalNodeTest::testExecuteElseEmitterViaExecuteTransition |
( |
| ) |
|
Definition at line 339 of file ilConditionalNodeTest.php.
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());
◆ testExecuteEmitterViaExecuteTransition()
ilConditionalNodeTest::testExecuteEmitterViaExecuteTransition |
( |
| ) |
|
Definition at line 311 of file ilConditionalNodeTest.php.
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());
◆ testExecuteTransitionElse()
ilConditionalNodeTest::testExecuteTransitionElse |
( |
| ) |
|
Definition at line 230 of file ilConditionalNodeTest.php.
References $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);
if(!array_key_exists('stateid', $_REQUEST)) $state
Handle linkback() response from LinkedIn.
◆ testExecuteTransitionThen()
ilConditionalNodeTest::testExecuteTransitionThen |
( |
| ) |
|
Definition at line 213 of file ilConditionalNodeTest.php.
References $state.
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);
if(!array_key_exists('stateid', $_REQUEST)) $state
Handle linkback() response from LinkedIn.
◆ testGetContext()
ilConditionalNodeTest::testGetContext |
( |
| ) |
|
Definition at line 49 of file ilConditionalNodeTest.php.
55 $actual = $node->getContext();
58 if ($actual === $this->workflow) {
59 $this->assertEquals($actual, $this->workflow);
61 $this->assertTrue(
false,
'Context not identical.');
◆ testIsActiveAndActivate()
ilConditionalNodeTest::testIsActiveAndActivate |
( |
| ) |
|
Definition at line 65 of file ilConditionalNodeTest.php.
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);
◆ testNotifyDetectorSatisfaction()
ilConditionalNodeTest::testNotifyDetectorSatisfaction |
( |
| ) |
|
Definition at line 470 of file ilConditionalNodeTest.php.
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());
◆ testNotifyDetectorSatisfactionAndTransit()
ilConditionalNodeTest::testNotifyDetectorSatisfactionAndTransit |
( |
| ) |
|
Definition at line 496 of file ilConditionalNodeTest.php.
References $GLOBALS.
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());
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
The documentation for this class was generated from the following file: