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 46 of file ilCounterDetectorTest.php.
47 {
48
50
51
52
53 $this->assertTrue(
54 true,
55 'Construction failed with valid context passed to constructor.'
56 );
57 }
@noinspection PhpIncludeInspection
◆ testGetContext()
ilCounterDetectorTest::testGetContext |
( |
| ) |
|
Definition at line 162 of file ilCounterDetectorTest.php.
163 {
164
166
167
168 $actual = $detector->getContext();
169
170
171 if ($actual === $this->node)
172 {
173 $this->assertEquals($actual, $this->node);
174 } else {
175 $this->assertTrue(false, 'Context not identical.');
176 }
177 }
◆ testSetGetActualTriggerEvents()
ilCounterDetectorTest::testSetGetActualTriggerEvents |
( |
| ) |
|
Definition at line 73 of file ilCounterDetectorTest.php.
74 {
75
77 $expected = 4711;
78
79
80 $detector->setActualTriggerEvents($expected);
81 $actual = $detector->getActualTriggerEvents();
82
83
84 $this->assertEquals($actual, $expected);
85 }
◆ testSetGetExpectedTriggerEvents()
ilCounterDetectorTest::testSetGetExpectedTriggerEvents |
( |
| ) |
|
Definition at line 59 of file ilCounterDetectorTest.php.
60 {
61
63 $expected = 4711;
64
65
66 $detector->setExpectedTriggerEvents($expected);
67 $actual = $detector->getExpectedTriggerEvents();
68
69
70 $this->assertEquals($actual, $expected);
71 }
◆ testTriggerOversatisfy()
ilCounterDetectorTest::testTriggerOversatisfy |
( |
| ) |
|
Definition at line 149 of file ilCounterDetectorTest.php.
150 {
151
153 $expected = 2;
154 $detector->setExpectedTriggerEvents($expected);
155
156
157 $this->assertTrue($detector->trigger(null));
158 $this->assertTrue($detector->trigger(null));
159 $this->assertFalse($detector->trigger(null));
160 }
◆ testTriggerSatisfy()
ilCounterDetectorTest::testTriggerSatisfy |
( |
| ) |
|
Definition at line 117 of file ilCounterDetectorTest.php.
118 {
119
121 $expected = 2;
122 $detector->setExpectedTriggerEvents($expected);
123
124
125 $detector->trigger(null);
126 $detector->trigger(null);
127
128
129 $valid_state = true;
130
131 if ($detector->getActualTriggerEvents() != 2)
132 {
133 $valid_state = false;
134 }
135
136 if($detector->getExpectedTriggerEvents() != $expected)
137 {
138 $valid_state = false;
139 }
140
141 if (!$detector->getDetectorState())
142 {
143 $valid_state = false;
144 }
145
146 $this->assertTrue($valid_state, 'Detector state invalid.');
147 }
◆ testTriggerUnsatisfy()
ilCounterDetectorTest::testTriggerUnsatisfy |
( |
| ) |
|
Definition at line 87 of file ilCounterDetectorTest.php.
88 {
89
91 $expected = 2;
92 $detector->setExpectedTriggerEvents($expected);
93
94
95 $detector->trigger(null);
96
97
98 $valid_state = true;
99 if ($detector->getActualTriggerEvents() != 1)
100 {
101 $valid_state = false;
102 }
103
104 if($detector->getExpectedTriggerEvents() != $expected)
105 {
106 $valid_state = false;
107 }
108
109 if ($detector->getDetectorState())
110 {
111 $valid_state = false;
112 }
113
114 $this->assertTrue($valid_state, 'Detector state invalid.');
115 }
The documentation for this class was generated from the following file: