ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilObjTestTest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
26 {
28 
29  protected function setUp(): void
30  {
31  parent::setUp();
32 
33  $this->addGlobal_ilBench();
34  $this->addGlobal_ilUser();
35  $this->addGlobal_ilCtrl();
36  $this->addGlobal_lng();
37  $this->addGlobal_ilias();
38  $this->addGlobal_ilDB();
39  $this->addGlobal_ilLog();
40  $this->addGlobal_ilErr();
41  $this->addGlobal_ilSetting();
42  $this->addGlobal_tree();
44  $this->addGlobal_objDefinition();
45  $this->addGlobal_filesystem();
48  $this->addGlobal_ilAccess();
49 
50  $this->testObj = new ilObjTest();
51  }
52 
54  {
55  $this->assertInstanceOf(ilObjTest::class, $this->testObj);
56  }
57 
58  public function testTmpCopyWizardCopyId(): void
59  {
60  $this->testObj->setTmpCopyWizardCopyId(12);
61  $this->assertEquals(12, $this->testObj->getTmpCopyWizardCopyId());
62  }
63 
64  /*public function testIntroductionEnabled(): void
65  {
66  $this->testObj->setIntroductionEnabled(false);
67  $this->assertFalse($this->testObj->isIntroductionEnabled());
68 
69  $this->testObj->setIntroductionEnabled(true);
70  $this->assertTrue($this->testObj->isIntroductionEnabled());
71  }
72 
73  public function testIntroduction(): void
74  {
75  $this->assertEmpty($this->testObj->getIntroduction());
76  $this->testObj->setIntroduction("Test");
77  $this->assertEquals("Test", $this->testObj->getIntroduction());
78  }
79 
80  public function testFinalStatement(): void
81  {
82  $this->assertEmpty($this->testObj->getFinalStatement());
83  $this->testObj->setFinalStatement("Test");
84  $this->assertEquals("Test", $this->testObj->getFinalStatement());
85  }
86 
87  public function testShowFinalStatement(): void
88  {
89  $this->testObj->setShowFinalStatement(0);
90  $this->assertEquals(0, $this->testObj->getShowFinalStatement());
91 
92  $this->testObj->setShowFinalStatement(1);
93  $this->assertEquals(1, $this->testObj->getShowFinalStatement());
94  }*/
95 
96  public function testTestId(): void
97  {
98  $this->testObj->setTestId(15);
99  $this->assertEquals(15, $this->testObj->getTestId());
100  }
101 
102  /*public function testSequenceSettings(): void
103  {
104  $this->testObj->setSequenceSettings(0);
105  $this->assertEquals(0, $this->testObj->getSequenceSettings());
106 
107  $this->testObj->setSequenceSettings(1);
108  $this->assertEquals(1, $this->testObj->getSequenceSettings());
109  }
110 
111  public function testIsPostponingEnabled(): void
112  {
113  $this->testObj->setSequenceSettings(0);
114  $this->assertfalse($this->testObj->isPostponingEnabled());
115 
116  $this->testObj->setSequenceSettings(1);
117  $this->assertTrue($this->testObj->isPostponingEnabled());
118  }
119 
120  public function testSetPostponingEnabled(): void
121  {
122  $this->testObj->setPostponingEnabled(0);
123  $this->assertfalse($this->testObj->isPostponingEnabled());
124 
125  $this->testObj->setPostponingEnabled(1);
126  $this->assertTrue($this->testObj->isPostponingEnabled());
127  }
128 
129  public function testScoreReporting(): void
130  {
131  $this->testObj->setScoreReporting(0);
132  $this->assertEquals(0, $this->testObj->getScoreReporting());
133 
134  $this->testObj->setScoreReporting(1);
135  $this->assertEquals(1, $this->testObj->getScoreReporting());
136  }
137 
138  public function testInstantFeedbackSolution(): void
139  {
140  $this->testObj->setInstantFeedbackSolution(0);
141  $this->assertEquals(0, $this->testObj->getInstantFeedbackSolution());
142 
143  $this->testObj->setInstantFeedbackSolution(200);
144  $this->assertEquals(0, $this->testObj->getInstantFeedbackSolution());
145 
146  $this->testObj->setInstantFeedbackSolution(1);
147  $this->assertEquals(1, $this->testObj->getInstantFeedbackSolution());
148  }
149 
150  public function testGenericAnswerFeedback(): void
151  {
152  $this->testObj->setGenericAnswerFeedback(0);
153  $this->assertEquals(0, $this->testObj->getGenericAnswerFeedback());
154 
155  $this->testObj->setGenericAnswerFeedback(200);
156  $this->assertEquals(0, $this->testObj->getGenericAnswerFeedback());
157 
158  $this->testObj->setGenericAnswerFeedback(1);
159  $this->assertEquals(1, $this->testObj->getGenericAnswerFeedback());
160  }
161 
162  public function testAnswerFeedbackPoints(): void
163  {
164  $this->testObj->setAnswerFeedbackPoints(0);
165  $this->assertEquals(0, $this->testObj->getAnswerFeedbackPoints());
166 
167  $this->testObj->setAnswerFeedbackPoints(200);
168  $this->assertEquals(0, $this->testObj->getAnswerFeedbackPoints());
169 
170  $this->testObj->setAnswerFeedbackPoints(1);
171  $this->assertEquals(1, $this->testObj->getAnswerFeedbackPoints());
172  }
173 
174  public function testIsScoreReportingEnabled(): void
175  {
176  $this->testObj->setScoreReporting(ilObjTestSettingsResultSummary::SCORE_REPORTING_FINISHED);
177  $this->assertTrue($this->testObj->isScoreReportingEnabled());
178 
179  $this->testObj->setScoreReporting(ilObjTestSettingsResultSummary::SCORE_REPORTING_IMMIDIATLY);
180  $this->assertTrue($this->testObj->isScoreReportingEnabled());
181 
182  $this->testObj->setScoreReporting(ilObjTestSettingsResultSummary::SCORE_REPORTING_DATE);
183  $this->assertTrue($this->testObj->isScoreReportingEnabled());
184 
185  $this->testObj->setScoreReporting(ilObjTestSettingsResultSummary::SCORE_REPORTING_AFTER_PASSED);
186  $this->assertTrue($this->testObj->isScoreReportingEnabled());
187 
188  $this->testObj->setScoreReporting(ilObjTestSettingsResultSummary::SCORE_REPORTING_DISABLED);
189  $this->assertFalse($this->testObj->isScoreReportingEnabled());
190 
191  $this->testObj->setScoreReporting(999);
192  $this->assertFalse($this->testObj->isScoreReportingEnabled());
193  }
194 
195  public function testBlockPassesAfterPassedEnabled(): void
196  {
197  $this->testObj->setBlockPassesAfterPassedEnabled(false);
198  $this->assertfalse($this->testObj->isBlockPassesAfterPassedEnabled());
199 
200  $this->testObj->setBlockPassesAfterPassedEnabled(true);
201  $this->assertTrue($this->testObj->isBlockPassesAfterPassedEnabled());
202  }
203 
204  public function testKiosk(): void
205  {
206  $this->testObj->setKiosk(0);
207  $this->assertEquals(0, $this->testObj->getKiosk());
208 
209  $this->testObj->setKiosk(22);
210  $this->assertEquals(22, $this->testObj->getKiosk());
211 
212  $this->testObj->setKiosk(1);
213  $this->assertEquals(1, $this->testObj->getKiosk());
214  }
215 
216  public function testGetKioskMode(): void
217  {
218  $this->testObj->setKiosk(0);
219  $this->assertEquals(false, $this->testObj->getKioskMode());
220 
221  $this->testObj->setKiosk(22);
222  $this->assertEquals(false, $this->testObj->getKioskMode());
223 
224  $this->testObj->setKiosk(1);
225  $this->assertEquals(1, $this->testObj->getKioskMode());
226  }
227 
228  public function testSetKioskMode(): void
229  {
230  $this->testObj->setKioskMode(false);
231  $this->assertFalse($this->testObj->getKioskMode());
232 
233  $this->testObj->setKioskMode(true);
234  $this->assertTrue($this->testObj->getKioskMode());
235  }
236 
237  public function testStartingTimeEnabled(): void
238  {
239  $this->testObj->setStartingTimeEnabled(false);
240  $this->assertFalse($this->testObj->isStartingTimeEnabled());
241 
242  $this->testObj->setStartingTimeEnabled(true);
243  $this->assertTrue($this->testObj->isStartingTimeEnabled());
244  }
245 
246  public function testStartingTime(): void
247  {
248  $this->testObj->setStartingTime(0);
249  $this->assertEquals(0, $this->testObj->getStartingTime());
250 
251  $this->testObj->setStartingTime(1);
252  $this->assertEquals(1, $this->testObj->getStartingTime());
253  }
254 
255  public function testEndingTimeEnabled(): void
256  {
257  $this->testObj->setEndingTimeEnabled(false);
258  $this->assertFalse($this->testObj->isEndingTimeEnabled());
259 
260  $this->testObj->setEndingTimeEnabled(true);
261  $this->assertTrue($this->testObj->isEndingTimeEnabled());
262  }
263 
264  public function testEndingTime(): void
265  {
266  $this->testObj->setEndingTime(0);
267  $this->assertEquals(0, $this->testObj->getEndingTime());
268 
269  $this->testObj->setEndingTime(1);
270  $this->assertEquals(1, $this->testObj->getEndingTime());
271  }
272 
273  public function testNrOfTries(): void
274  {
275  $this->testObj->setNrOfTries(0);
276  $this->assertEquals(0, $this->testObj->getNrOfTries());
277 
278  $this->testObj->setNrOfTries(22);
279  $this->assertEquals(22, $this->testObj->getNrOfTries());
280 
281  $this->testObj->setNrOfTries(1);
282  $this->assertEquals(1, $this->testObj->getNrOfTries());
283  }
284 
285  public function testUsePreviousAnswers(): void
286  {
287  $this->testObj->setUsePreviousAnswers(0);
288  $this->assertEquals(0, $this->testObj->getUsePreviousAnswers());
289 
290  $this->testObj->setUsePreviousAnswers(1);
291  $this->assertEquals(1, $this->testObj->getUsePreviousAnswers());
292  }
293 
294  public function testRedirectionMode(): void
295  {
296  $this->testObj->setRedirectionMode(0);
297  $this->assertEquals(0, $this->testObj->getRedirectionMode());
298 
299  $this->testObj->setRedirectionMode(1);
300  $this->assertEquals(1, $this->testObj->getRedirectionMode());
301  }
302 
303  public function testRedirectionUrl(): void
304  {
305  $this->testObj->setRedirectionUrl("Test");
306  $this->assertEquals("Test", $this->testObj->getRedirectionUrl());
307  }
308 
309  public function testProcessingTime(): void
310  {
311  $this->testObj->setProcessingTime("Test");
312  $this->assertEquals("Test", $this->testObj->getProcessingTime());
313  }
314 
315  public function testSetProcessingTimeByMinutes(): void
316  {
317  $this->testObj->setProcessingTimeByMinutes(12);
318  $this->assertEquals("00:12:00", $this->testObj->getProcessingTime());
319  }
320 
321  public function testEnableProcessingTime(): void
322  {
323  $this->testObj->setEnableProcessingTime(0);
324  $this->assertEquals(0, $this->testObj->getEnableProcessingTime());
325 
326  $this->testObj->setEnableProcessingTime(1);
327  $this->assertEquals(1, $this->testObj->getEnableProcessingTime());
328  }
329 
330  public function testResetProcessingTime(): void
331  {
332  $this->testObj->setResetProcessingTime(0);
333  $this->assertEquals(0, $this->testObj->getResetProcessingTime());
334 
335  $this->testObj->setResetProcessingTime(1);
336  $this->assertEquals(1, $this->testObj->getResetProcessingTime());
337  }
338 
339  public function testPasswordEnabled(): void
340  {
341  $this->testObj->setPasswordEnabled(false);
342  $this->assertEquals(false, $this->testObj->isPasswordEnabled());
343 
344  $this->testObj->setPasswordEnabled(true);
345  $this->assertEquals(true, $this->testObj->isPasswordEnabled());
346  }
347 
348  public function testPassword(): void
349  {
350  $this->testObj->setPassword("Test");
351  $this->assertEquals("Test", $this->testObj->getPassword());
352  }
353 
354  public function testPassWaiting(): void
355  {
356  $this->testObj->setPassWaiting("Test");
357  $this->assertEquals("Test", $this->testObj->getPassWaiting());
358  }
359 
360  public function testShuffleQuestions(): void
361  {
362  $this->testObj->setShuffleQuestions(false);
363  $this->assertEquals(false, $this->testObj->getShuffleQuestions());
364 
365  $this->testObj->setShuffleQuestions(true);
366  $this->assertEquals(true, $this->testObj->getShuffleQuestions());
367  }
368 
369  public function testListOfQuestionsSettings(): void
370  {
371  $this->testObj->setListOfQuestionsSettings(0);
372  $this->assertEquals(0, $this->testObj->getListOfQuestionsSettings());
373 
374  $this->testObj->setListOfQuestionsSettings(1);
375  $this->assertEquals(1, $this->testObj->getListOfQuestionsSettings());
376 
377  $this->testObj->setListOfQuestionsSettings(22);
378  $this->assertEquals(22, $this->testObj->getListOfQuestionsSettings());
379  }
380 
381  public function testListOfQuestions(): void
382  {
383  $this->testObj->setListOfQuestions(0);
384  $this->assertfalse($this->testObj->getListOfQuestions());
385 
386  $this->testObj->setListOfQuestions(1);
387  $this->assertTrue($this->testObj->getListOfQuestions());
388  }*/
389 }
Class ilObjTestTest.
test_instantiateObject_shouldReturnInstance()
Class ilTestBaseClass.
ilObjTest $testObj