19 include_once(
"./Services/PHPUnit/classes/class.ilUnitUtil.php");
23 require_once
'./Services/WorkflowEngine/classes/workflows/class.ilEmptyWorkflow.php';
27 require_once
'./Services/WorkflowEngine/classes/nodes/class.ilBasicNode.php';
31 $this->workflow->addNode($this->node);
33 require_once
'./Services/WorkflowEngine/classes/detectors/class.ilCounterDetector.php';
39 if ($ilSetting != null) {
40 $ilSetting->delete(
'IL_PHPUNIT_TEST_TIME');
41 $ilSetting->delete(
'IL_PHPUNIT_TEST_MICROTIME');
54 'Construction failed with valid context passed to constructor.' 65 $detector->setExpectedTriggerEvents($expected);
66 $actual = $detector->getExpectedTriggerEvents();
69 $this->assertEquals($actual, $expected);
79 $detector->setActualTriggerEvents($expected);
80 $actual = $detector->getActualTriggerEvents();
83 $this->assertEquals($actual, $expected);
91 $detector->setExpectedTriggerEvents($expected);
94 $detector->trigger(null);
98 if ($detector->getActualTriggerEvents() != 1) {
102 if ($detector->getExpectedTriggerEvents() != $expected) {
103 $valid_state =
false;
106 if ($detector->getDetectorState()) {
107 $valid_state =
false;
110 $this->assertTrue($valid_state,
'Detector state invalid.');
118 $detector->setExpectedTriggerEvents($expected);
121 $detector->trigger(null);
122 $detector->trigger(null);
127 if ($detector->getActualTriggerEvents() != 2) {
128 $valid_state =
false;
131 if ($detector->getExpectedTriggerEvents() != $expected) {
132 $valid_state =
false;
135 if (!$detector->getDetectorState()) {
136 $valid_state =
false;
139 $this->assertTrue($valid_state,
'Detector state invalid.');
147 $detector->setExpectedTriggerEvents($expected);
150 $this->assertTrue($detector->trigger(null));
151 $this->assertTrue($detector->trigger(null));
152 $this->assertFalse($detector->trigger(null));
161 $actual = $detector->getContext();
164 if ($actual === $this->node) {
165 $this->assertEquals($actual, $this->node);
167 $this->assertTrue(
false,
'Context not identical.');
testConstructorValidContext()
testSetGetExpectedTriggerEvents()
ilCounterDetectorTest is part of the petri net based workflow engine.
testSetGetActualTriggerEvents()