ilCounterDetectorTest is part of the petri net based workflow engine.
More...
ilCounterDetectorTest is part of the petri net based workflow engine.
This class holds all tests for the class detectors/class.ilCounterDetector
- Author
- Maximilian Becker mbeck.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de
- Version
- $Id$
/
Definition at line 15 of file ilCounterDetectorTest.php.
◆ setUp()
ilCounterDetectorTest::setUp |
( |
| ) |
|
Definition at line 17 of file ilCounterDetectorTest.php.
18 {
19 include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
20
21
22
23 require_once './Services/WorkflowEngine/classes/workflows/class.ilEmptyWorkflow.php';
25
26
27 require_once './Services/WorkflowEngine/classes/nodes/class.ilBasicNode.php';
29
30
31 $this->workflow->addNode($this->node);
32
33 require_once './Services/WorkflowEngine/classes/detectors/class.ilCounterDetector.php';
34 }
@noinspection PhpIncludeInspection
@noinspection PhpIncludeInspection
◆ tearDown()
ilCounterDetectorTest::tearDown |
( |
| ) |
|
◆ testConstructorValidContext()
ilCounterDetectorTest::testConstructorValidContext |
( |
| ) |
|
Definition at line 45 of file ilCounterDetectorTest.php.
46 {
47
49
50
51
52 $this->assertTrue(
53 true,
54 'Construction failed with valid context passed to constructor.'
55 );
56 }
@noinspection PhpIncludeInspection
◆ testGetContext()
ilCounterDetectorTest::testGetContext |
( |
| ) |
|
Definition at line 155 of file ilCounterDetectorTest.php.
156 {
157
159
160
161 $actual = $detector->getContext();
162
163
164 if ($actual === $this->node) {
165 $this->assertEquals($actual, $this->node);
166 } else {
167 $this->assertTrue(false, 'Context not identical.');
168 }
169 }
◆ testSetGetActualTriggerEvents()
ilCounterDetectorTest::testSetGetActualTriggerEvents |
( |
| ) |
|
Definition at line 72 of file ilCounterDetectorTest.php.
73 {
74
76 $expected = 4711;
77
78
79 $detector->setActualTriggerEvents($expected);
80 $actual = $detector->getActualTriggerEvents();
81
82
83 $this->assertEquals($actual, $expected);
84 }
◆ testSetGetExpectedTriggerEvents()
ilCounterDetectorTest::testSetGetExpectedTriggerEvents |
( |
| ) |
|
Definition at line 58 of file ilCounterDetectorTest.php.
59 {
60
62 $expected = 4711;
63
64
65 $detector->setExpectedTriggerEvents($expected);
66 $actual = $detector->getExpectedTriggerEvents();
67
68
69 $this->assertEquals($actual, $expected);
70 }
◆ testTriggerOversatisfy()
ilCounterDetectorTest::testTriggerOversatisfy |
( |
| ) |
|
Definition at line 142 of file ilCounterDetectorTest.php.
143 {
144
146 $expected = 2;
147 $detector->setExpectedTriggerEvents($expected);
148
149
150 $this->assertTrue($detector->trigger(null));
151 $this->assertTrue($detector->trigger(null));
152 $this->assertFalse($detector->trigger(null));
153 }
◆ testTriggerSatisfy()
ilCounterDetectorTest::testTriggerSatisfy |
( |
| ) |
|
Definition at line 113 of file ilCounterDetectorTest.php.
114 {
115
117 $expected = 2;
118 $detector->setExpectedTriggerEvents($expected);
119
120
121 $detector->trigger(null);
122 $detector->trigger(null);
123
124
125 $valid_state = true;
126
127 if ($detector->getActualTriggerEvents() != 2) {
128 $valid_state = false;
129 }
130
131 if ($detector->getExpectedTriggerEvents() != $expected) {
132 $valid_state = false;
133 }
134
135 if (!$detector->getDetectorState()) {
136 $valid_state = false;
137 }
138
139 $this->assertTrue($valid_state, 'Detector state invalid.');
140 }
◆ testTriggerUnsatisfy()
ilCounterDetectorTest::testTriggerUnsatisfy |
( |
| ) |
|
Definition at line 86 of file ilCounterDetectorTest.php.
87 {
88
90 $expected = 2;
91 $detector->setExpectedTriggerEvents($expected);
92
93
94 $detector->trigger(null);
95
96
97 $valid_state = true;
98 if ($detector->getActualTriggerEvents() != 1) {
99 $valid_state = false;
100 }
101
102 if ($detector->getExpectedTriggerEvents() != $expected) {
103 $valid_state = false;
104 }
105
106 if ($detector->getDetectorState()) {
107 $valid_state = false;
108 }
109
110 $this->assertTrue($valid_state, 'Detector state invalid.');
111 }
The documentation for this class was generated from the following file: