ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ScoreSettingsTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
23 use ILIAS\UI\Component as C;
27 use ILIAS\Data;
29 
31 {
32  public function testScoreSettingsBuild(): void
33  {
34  $id = -666;
35  $s = new ilObjTestScoreSettings(
36  $id,
41  );
42  $this->assertInstanceOf(ilObjTestScoreSettings::class, $s);
43  $this->assertEquals($id, $s->getTestId());
44  $this->assertInstanceOf(ilObjTestSettingsScoring::class, $s->getScoringSettings());
45  $this->assertInstanceOf(ilObjTestSettingsResultSummary::class, $s->getResultSummarySettings());
46  $this->assertInstanceOf(ilObjTestSettingsResultDetails::class, $s->getResultDetailsSettings());
47  $this->assertInstanceOf(ilObjTestSettingsGamification::class, $s->getGamificationSettings());
48  }
49 
50  public function testScoreSettingsScoring(): void
51  {
52  $s = new ilObjTestSettingsScoring(-666);
53  $this->assertEquals(-667, $s->withTestId(-667)->getTestId());
54  $this->assertEquals(2, $s->withCountSystem(2)->getCountSystem());
55  $this->assertEquals(4, $s->withScoreCutting(4)->getScoreCutting());
56  $this->assertEquals(5, $s->withPassScoring(5)->getPassScoring());
57  }
58 
59  public function testScoreSettingsSummary(): void
60  {
61  $dat = new \DateTimeImmutable();
62  $s = new ilObjTestSettingsResultSummary(-666);
63  $this->assertEquals(5, $s->withScoreReporting(5)->getScoreReporting());
64  $this->assertTrue($s->withScoreReporting(1)->getScoreReportingEnabled());
65  $this->assertFalse($s->withScoreReporting(0)->getScoreReportingEnabled());
66  $this->assertEquals($dat, $s->withReportingDate($dat)->getReportingDate());
67  $this->assertTrue($s->withShowGradingStatusEnabled(true)->getShowGradingStatusEnabled());
68  $this->assertFalse($s->withShowGradingStatusEnabled(false)->getShowGradingStatusEnabled());
69  $this->assertTrue($s->withShowGradingMarkEnabled(true)->getShowGradingMarkEnabled());
70  $this->assertFalse($s->withShowGradingMarkEnabled(false)->getShowGradingMarkEnabled());
71  $this->assertTrue($s->withPassDeletionAllowed(true)->getPassDeletionAllowed());
72  $this->assertFalse($s->withPassDeletionAllowed(false)->getPassDeletionAllowed());
73  $this->assertTrue($s->withShowPassDetails(true)->getShowPassDetails());
74  $this->assertFalse($s->withShowPassDetails(false)->getShowPassDetails());
75  }
76 
77  public function testScoreSettingsDetails(): void
78  {
79  $s = new ilObjTestSettingsResultDetails(-666);
80  $this->assertTrue($s->withPrintBestSolutionWithResult(true)->getPrintBestSolutionWithResult());
81  $this->assertEquals(192, $s->withResultsPresentation(192)->getResultsPresentation(192));
82  $this->assertTrue($s->withShowExamIdInTestResults(true)->getShowExamIdInTestResults());
83  $this->assertTrue($s->withShowPassDetails(true)->getShowPassDetails());
84  $this->assertFalse($s->withShowPassDetails(false)->getShowPassDetails());
85  $this->assertTrue($s->withShowSolutionDetails(true)->getShowSolutionDetails());
86  $this->assertFalse($s->withShowSolutionDetails(false)->getShowSolutionDetails());
87  $this->assertTrue($s->withShowSolutionPrintview(true)->getShowSolutionPrintview());
88  $this->assertFalse($s->withShowSolutionPrintview(false)->getShowSolutionPrintview());
89  $this->assertTrue($s->withShowSolutionFeedback(true)->getShowSolutionFeedback());
90  $this->assertFalse($s->withShowSolutionFeedback(false)->getShowSolutionFeedback());
91  $this->assertTrue($s->withShowSolutionAnswersOnly(true)->getShowSolutionAnswersOnly());
92  $this->assertFalse($s->withShowSolutionAnswersOnly(false)->getShowSolutionAnswersOnly());
93  $this->assertTrue($s->withShowSolutionSignature(true)->getShowSolutionSignature());
94  $this->assertFalse($s->withShowSolutionSignature(false)->getShowSolutionSignature());
95  $this->assertTrue($s->withShowSolutionSuggested(true)->getShowSolutionSuggested());
96  $this->assertFalse($s->withShowSolutionSuggested(false)->getShowSolutionSuggested());
97  $this->assertTrue($s->withShowSolutionListComparison(true)->getShowSolutionListComparison());
98  $this->assertFalse($s->withShowSolutionListComparison(false)->getShowSolutionListComparison());
99  $this->assertTrue($s->withExportSettingsSingleChoiceShort(true)->getExportSettingsSingleChoiceShort());
100  $this->assertFalse($s->withExportSettingsSingleChoiceShort(false)->getExportSettingsSingleChoiceShort());
101  $this->assertTrue($s->withShowPassDetails(true)->getShowPassDetails());
102  $tax_ids = [1,3,5,17];
103  $this->assertEquals($tax_ids, $s->withTaxonomyFilterIds($tax_ids)->getTaxonomyFilterIds());
104  }
105 
106  public function testScoreSettingsGamification(): void
107  {
108  $s = new ilObjTestSettingsGamification(-666);
109  $this->assertTrue($s->withHighscoreEnabled(true)->getHighscoreEnabled());
110  $this->assertFalse($s->withHighscoreEnabled(false)->getHighscoreEnabled());
111  $this->assertTrue($s->withHighscoreAnon(true)->getHighscoreAnon());
112  $this->assertFalse($s->withHighscoreAnon(false)->getHighscoreAnon());
113  $this->assertTrue($s->withHighscoreAchievedTS(true)->getHighscoreAchievedTS());
114  $this->assertFalse($s->withHighscoreAchievedTS(false)->getHighscoreAchievedTS());
115  $this->assertTrue($s->withHighscoreScore(true)->getHighscoreScore());
116  $this->assertFalse($s->withHighscoreScore(false)->getHighscoreScore());
117  $this->assertTrue($s->withHighscorePercentage(true)->getHighscorePercentage());
118  $this->assertFalse($s->withHighscorePercentage(false)->getHighscorePercentage());
119  $this->assertTrue($s->withHighscoreHints(true)->getHighscoreHints());
120  $this->assertFalse($s->withHighscoreHints(false)->getHighscoreHints());
121  $this->assertTrue($s->withHighscoreWTime(true)->getHighscoreWTime());
122  $this->assertFalse($s->withHighscoreWTime(false)->getHighscoreWTime());
123  $this->assertTrue($s->withHighscoreOwnTable(true)->getHighscoreOwnTable());
124  $this->assertFalse($s->withHighscoreOwnTable(false)->getHighscoreOwnTable());
125  $this->assertTrue($s->withHighscoreTopTable(true)->getHighscoreTopTable());
126  $this->assertFalse($s->withHighscoreTopTable(false)->getHighscoreTopTable());
127  $this->assertEquals(15, $s->withHighscoreTopNum(15)->getHighscoreTopNum());
128  }
129 
130 
131 
132  protected function getFieldFactory()
133  {
134  $factory = new I\Input\Field\Factory(
135  $this->createMock(I\Input\UploadLimitResolver::class),
137  new Data\Factory(),
138  $this->getRefinery(),
139  $this->getLanguage()
140  );
141  return $factory;
142  }
143 
144  protected function getUIPack()
145  {
146  return [
147  $this->getLanguage(),
148  $this->getFieldFactory(),
149  $this->getRefinery()
150  ];
151  }
152 
153  public function testScoreSettingsSectionScoring(): void
154  {
155  $s = new ilObjTestSettingsScoring(666);
156  $actual = $this->getDefaultRenderer()->render(
157  $s->toForm(...$this->getUIPack())
158  );
159 
160  $expected = <<<EOT
161 <div class="il-section-input">
162  <div class="il-section-input-header"><h2>test_scoring</h2></div>
163 
164  <div class="form-group row">
165  <label class="control-label col-sm-4 col-md-3 col-lg-2">tst_text_count_system</label>
166  <div class="col-sm-8 col-md-9 col-lg-10">
167  <div id="id_1" class="il-input-radio">
168 
169  <div class="form-control form-control-sm il-input-radiooption">
170  <input type="radio" id="id_1_0_opt" name="" value="0" checked="checked" />
171  <label for="id_1_0_opt">tst_count_partial_solutions</label>
172  <div class="help-block">tst_count_partial_solutions_desc</div>
173  </div>
174  <div class="form-control form-control-sm il-input-radiooption">
175  <input type="radio" id="id_1_1_opt" name="" value="1" />
176  <label for="id_1_1_opt">tst_count_correct_solutions</label>
177  <div class="help-block">tst_count_correct_solutions_desc</div>
178  </div>
179 
180  </div>
181  </div>
182  </div>
183 
184  <div class="form-group row">
185  <label class="control-label col-sm-4 col-md-3 col-lg-2">tst_score_cutting</label>
186  <div class="col-sm-8 col-md-9 col-lg-10">
187  <div id="id_2" class="il-input-radio">
188 
189  <div class="form-control form-control-sm il-input-radiooption">
190  <input type="radio" id="id_2_0_opt" name="" value="0" checked="checked" />
191  <label for="id_2_0_opt">tst_score_cut_question</label>
192  <div class="help-block">tst_score_cut_question_desc</div>
193  </div>
194  <div class="form-control form-control-sm il-input-radiooption">
195  <input type="radio" id="id_2_1_opt" name="" value="1" />
196  <label for="id_2_1_opt">tst_score_cut_test</label>
197  <div class="help-block">tst_score_cut_test_desc</div>
198  </div>
199 
200  </div>
201  </div>
202  </div>
203 
204  <div class="form-group row">
205  <label class="control-label col-sm-4 col-md-3 col-lg-2">tst_pass_scoring</label>
206  <div class="col-sm-8 col-md-9 col-lg-10">
207  <div id="id_3" class="il-input-radio">
208  <div class="form-control form-control-sm il-input-radiooption">
209  <input type="radio" id="id_3_0_opt" name="" value="0" checked="checked" />
210  <label for="id_3_0_opt">tst_pass_last_pass</label>
211  <div class="help-block">tst_pass_last_pass_desc</div>
212  </div>
213  <div class="form-control form-control-sm il-input-radiooption">
214  <input type="radio" id="id_3_1_opt" name="" value="1" />
215  <label for="id_3_1_opt">tst_pass_best_pass</label>
216  <div class="help-block">tst_pass_best_pass_desc</div>
217  </div>
218  </div>
219  </div>
220  </div>
221 </div>
222 EOT;
223 
224  $this->assertHTMLEquals(
225  $this->brutallyTrimHTML($expected),
226  $this->brutallyTrimHTML($this->brutallyTrimSignals($actual))
227  );
228  }
229 
230 
231  public function getUIFactory(): NoUIFactory
232  {
233  return new class () extends NoUIFactory {
234  public function symbol(): C\Symbol\Factory
235  {
236  return new S\Factory(
237  new S\Icon\Factory(),
238  new S\Glyph\Factory(),
239  new S\Avatar\Factory()
240  );
241  }
242  };
243  }
244 
245  public function testScoreSettingsSectionSummary(): void
246  {
247  $data_factory = new \ILIAS\Data\Factory();
248  $language = $this->getLanguage();
249  $refinery = new \ILIAS\Refinery\Factory($data_factory, $language);
250 
252  $this->createMock(\ILIAS\UI\Implementation\Component\Input\UploadLimitResolver::class),
254  $data_factory,
255  $refinery,
256  $language
257  );
258  $ui = [$language, $field_factory, $refinery];
259 
260  $s = new ilObjTestSettingsResultSummary(666);
261  $actual = $this->getDefaultRenderer()->render(
262  $s->toForm(...array_merge($ui, [[
263  'user_time_zone' => 'Europe/Berlin',
264  'user_date_format' => $data_factory->dateFormat()->standard()
265  ]]))
266  );
267 
268  $expected = <<<EOT
269 <div class="il-section-input">
270  <div class="il-section-input-header"><h2>test_results</h2></div>
271  <div class="form-group row">
272  <label for="id_8" class="control-label col-sm-4 col-md-3 col-lg-2">tst_results_access_enabled</label>
273  <div class="col-sm-8 col-md-9 col-lg-10">
274  <input type="checkbox" id="id_8" value="checked" name="" class="form-control form-control-sm" />
275  <div class="help-block">tst_results_access_enabled_desc</div>
276  <div class="form-group row">
277  <label class="control-label col-sm-4 col-md-3 col-lg-2">tst_results_access_setting<span class="asterisk">*</span></label>
278  <div class="col-sm-8 col-md-9 col-lg-10">
279  <div id="id_2" class="il-input-radio">
280  <div class="form-control form-control-sm il-input-radiooption">
281  <input type="radio" id="id_2_2_opt" name="" value="2" />
282  <label for="id_2_2_opt">tst_results_access_always</label>
283  <div class="help-block">tst_results_access_always_desc</div>
284  </div>
285  <div class="form-control form-control-sm il-input-radiooption">
286  <input type="radio" id="id_2_1_opt" name="" value="1" />
287  <label for="id_2_1_opt">tst_results_access_finished</label>
288  <div class="help-block">tst_results_access_finished_desc</div>
289  </div>
290  <div class="form-control form-control-sm il-input-radiooption">
291  <input type="radio" id="id_2_4_opt" name="" value="4" />
292  <label for="id_2_4_opt">tst_results_access_passed</label>
293  <div class="help-block">tst_results_access_passed_desc</div>
294  </div>
295 
296  <div class="form-control form-control-sm il-input-radiooption">
297  <input type="radio" id="id_2_3_opt" name="" value="3" />
298  <label for="id_2_3_opt">tst_results_access_date</label>
299  <div class="form-group row">
300  <label for="id_3" class="control-label col-sm-4 col-md-3 col-lg-2">tst_reporting_date<span class="asterisk">*</span></label>
301  <div class="col-sm-8 col-md-9 col-lg-10">
302  <div class="input-group date il-input-datetime" id="id_3">
303  <input type="text" name="" placeholder="YYYY-MM-DD HH:mm" class="form-control form-control-sm" />
304  <span class="input-group-addon"><a tabindex="0" class="glyph" href="#" aria-label="calendar"><span class="glyphicon glyphicon-calendar" aria-hidden="true"></span></a></span>
305  </div>
306  </div>
307  </div>
308  <div class="help-block">tst_results_access_date_desc</div>
309  </div>
310  </div>
311  </div>
312  </div>
313 
314  <div class="form-group row">
315  <label for="id_4" class="control-label col-sm-4 col-md-3 col-lg-2">tst_results_grading_opt_show_status</label>
316  <div class="col-sm-8 col-md-9 col-lg-10">
317  <input type="checkbox" id="id_4" value="checked" name="" class="form-control form-control-sm" />
318  <div class="help-block">tst_results_grading_opt_show_status_desc</div>
319  </div>
320  </div>
321  <div class="form-group row">
322  <label for="id_5" class="control-label col-sm-4 col-md-3 col-lg-2">tst_results_grading_opt_show_mark</label>
323  <div class="col-sm-8 col-md-9 col-lg-10">
324  <input type="checkbox" id="id_5" value="checked" name="" class="form-control form-control-sm" />
325  <div class="help-block">tst_results_grading_opt_show_mark_desc</div>
326  </div>
327  </div>
328  <div class="form-group row">
329  <label for="id_6" class="control-label col-sm-4 col-md-3 col-lg-2">tst_results_grading_opt_show_details</label>
330  <div class="col-sm-8 col-md-9 col-lg-10">
331  <input type="checkbox" id="id_6" value="checked" name="" class="form-control form-control-sm" />
332  <div class="help-block">tst_results_grading_opt_show_details_desc</div>
333  </div>
334  </div>
335  <div class="form-group row">
336  <label for="id_7" class="control-label col-sm-4 col-md-3 col-lg-2">tst_pass_deletion</label>
337  <div class="col-sm-8 col-md-9 col-lg-10">
338  <input type="checkbox" id="id_7" value="checked" name="" class="form-control form-control-sm" />
339  <div class="help-block">tst_pass_deletion_allowed</div>
340  </div>
341  </div>
342  </div>
343  </div>
344 </div>
345 EOT;
346 
347  $this->assertHTMLEquals(
348  $this->brutallyTrimHTML($expected),
349  $this->brutallyTrimHTML($this->brutallyTrimSignals($actual))
350  );
351  }
352 
353 
354 
355 
356  public function testScoreSettingsSectionDetails(): void
357  {
358  $s = new ilObjTestSettingsResultDetails(666);
359  $tax_ids = [1,2];
360  $actual = $this->getDefaultRenderer()->render(
361  $s->toForm(
362  ...array_merge(
363  $this->getUIPack(),
364  [['taxonomy_options' => $tax_ids]]
365  )
366  )
367  );
368 
369  $expected = <<<EOT
370 <div class="il-section-input">
371  <div class="il-section-input-header"><h2>tst_results_details_options</h2></div>
372  <div class="form-group row">
373  <label for="id_3" class="control-label col-sm-4 col-md-3 col-lg-2">tst_show_solution_details</label>
374  <div class="col-sm-8 col-md-9 col-lg-10">
375  <input type="checkbox" id="id_3" value="checked" name="" class="form-control form-control-sm" />
376  <div class="help-block">tst_show_solution_details_desc</div>
377  <div class="form-group row">
378  <label for="id_2" class="control-label col-sm-4 col-md-3 col-lg-2">tst_results_print_best_solution</label>
379  <div class="col-sm-8 col-md-9 col-lg-10">
380  <input type="checkbox" id="id_2" value="checked" name="" class="form-control form-control-sm" />
381  <div class="help-block">tst_results_print_best_solution_info</div>
382  </div>
383  </div>
384  </div>
385  </div>
386 
387  <div class="form-group row">
388  <label for="id_6" class="control-label col-sm-4 col-md-3 col-lg-2">tst_show_solution_details_singlepage</label>
389  <div class="col-sm-8 col-md-9 col-lg-10">
390  <input type="checkbox" id="id_6" value="checked" name="" class="form-control form-control-sm" />
391  <div class="help-block">tst_show_solution_details_singlepage_desc</div>
392  <div class="form-group row">
393  <label for="id_5" class="control-label col-sm-4 col-md-3 col-lg-2">tst_results_print_best_solution_singlepage</label>
394  <div class="col-sm-8 col-md-9 col-lg-10">
395  <input type="checkbox" id="id_5" value="checked" checked="checked" name="" class="form-control form-control-sm" />
396  <div class="help-block">tst_results_print_best_solution_singlepage_info</div>
397  </div>
398  </div>
399  </div>
400  </div>
401 
402  <div class="form-group row">
403  <label for="id_7" class="control-label col-sm-4 col-md-3 col-lg-2">tst_show_solution_feedback</label>
404  <div class="col-sm-8 col-md-9 col-lg-10">
405  <input type="checkbox" id="id_7" value="checked" name="" class="form-control form-control-sm" /><div class="help-block">tst_show_solution_feedback_desc</div>
406  </div>
407  </div>
408 
409  <div class="form-group row">
410  <label for="id_8" class="control-label col-sm-4 col-md-3 col-lg-2">tst_show_solution_suggested</label><div class="col-sm-8 col-md-9 col-lg-10">
411  <input type="checkbox" id="id_8" value="checked" name="" class="form-control form-control-sm" /><div class="help-block">tst_show_solution_suggested_desc</div>
412  </div>
413  </div>
414 
415  <div class="form-group row">
416  <label for="id_9" class="control-label col-sm-4 col-md-3 col-lg-2">tst_show_solution_printview</label><div class="col-sm-8 col-md-9 col-lg-10">
417  <input type="checkbox" id="id_9" value="checked" name="" class="form-control form-control-sm" /><div class="help-block">tst_show_solution_printview_desc</div>
418  </div>
419  </div>
420 
421  <div class="form-group row">
422  <label for="id_10" class="control-label col-sm-4 col-md-3 col-lg-2">tst_hide_pagecontents</label><div class="col-sm-8 col-md-9 col-lg-10">
423  <input type="checkbox" id="id_10" value="checked" name="" class="form-control form-control-sm" /><div class="help-block">tst_hide_pagecontents_desc</div>
424  </div>
425  </div>
426 
427  <div class="form-group row">
428  <label for="id_11" class="control-label col-sm-4 col-md-3 col-lg-2">tst_show_solution_signature</label><div class="col-sm-8 col-md-9 col-lg-10">
429  <input type="checkbox" id="id_11" value="checked" name="" class="form-control form-control-sm" /><div class="help-block">tst_show_solution_signature_desc</div>
430  </div>
431  </div>
432 
433  <div class="form-group row">
434  <label for="id_12" class="control-label col-sm-4 col-md-3 col-lg-2">examid_in_test_res</label><div class="col-sm-8 col-md-9 col-lg-10">
435  <input type="checkbox" id="id_12" value="checked" checked="checked" name="" class="form-control form-control-sm" /><div class="help-block">examid_in_test_res_desc</div>
436  </div>
437  </div>
438 
439  <div class="form-group row">
440  <label for="id_13" class="control-label col-sm-4 col-md-3 col-lg-2">tst_exp_sc_short</label><div class="col-sm-8 col-md-9 col-lg-10">
441  <input type="checkbox" id="id_13" value="checked" name="" class="form-control form-control-sm" /><div class="help-block">tst_exp_sc_short_desc</div>
442  </div>
443  </div>
444 
445  <div class="form-group row">
446  <label class="control-label col-sm-4 col-md-3 col-lg-2">tst_results_tax_filters</label>
447  <div class="col-sm-8 col-md-9 col-lg-10">
448  <ul class="il-input-multiselect" id="id_14">
449  <li>
450  <input type="checkbox" name="[]" value="0" /><span>1</span>
451  </li>
452  <li>
453  <input type="checkbox" name="[]" value="1" /><span>2</span>
454  </li>
455  </ul>
456  </div>
457  </div>
458 
459 </div>
460 EOT;
461 
462  $this->assertHTMLEquals(
463  $this->brutallyTrimHTML($expected),
464  $this->brutallyTrimHTML($this->brutallyTrimSignals($actual))
465  );
466  }
467 
468 
469  public function testScoreSettingsSectionGamification(): void
470  {
471  $s = new ilObjTestSettingsGamification(666);
472  $actual = $this->getDefaultRenderer()->render(
473  $s->toForm(...$this->getUIPack())
474  );
475 
476  $expected = <<<EOT
477 <div class="il-section-input">
478 
479  <div class="il-section-input-header"><h2>tst_results_gamification</h2></div>
480 
481  <div class="form-group row">
482  <label for="id_10" class="control-label col-sm-4 col-md-3 col-lg-2">tst_highscore_enabled</label>
483  <div class="col-sm-8 col-md-9 col-lg-10">
484  <input type="checkbox" id="id_10" value="checked" name="" class="form-control form-control-sm" />
485  <div class="help-block">tst_highscore_description</div>
486 
487  <div class="form-group row">
488  <label class="control-label col-sm-4 col-md-3 col-lg-2">tst_highscore_mode<span class="asterisk">*</span></label>
489  <div class="col-sm-8 col-md-9 col-lg-10">
490  <div id="id_2" class="il-input-radio">
491  <div class="form-control form-control-sm il-input-radiooption">
492  <input type="radio" id="id_2_1_opt" name="" value="1" />
493  <label for="id_2_1_opt">tst_highscore_own_table</label>
494  <div class="help-block">tst_highscore_own_table_description</div>
495  </div>
496 
497  <div class="form-control form-control-sm il-input-radiooption">
498  <input type="radio" id="id_2_2_opt" name="" value="2" />
499  <label for="id_2_2_opt">tst_highscore_top_table</label>
500  <div class="help-block">tst_highscore_top_table_description</div>
501  </div>
502 
503  <div class="form-control form-control-sm il-input-radiooption">
504  <input type="radio" id="id_2_3_opt" name="" value="3" checked="checked" />
505  <label for="id_2_3_opt">tst_highscore_all_tables</label>
506  <div class="help-block">tst_highscore_all_tables_description</div>
507  </div>
508  </div>
509  </div>
510  </div>
511 
512  <div class="form-group row">
513  <label for="id_3" class="control-label col-sm-4 col-md-3 col-lg-2">tst_highscore_top_num<span class="asterisk">*</span></label>
514  <div class="col-sm-8 col-md-9 col-lg-10">
515  <input id="id_3" type="number" value="10" name="" class="form-control form-control-sm" />
516  <div class="help-block">tst_highscore_top_num_description</div>
517  </div>
518  </div>
519 
520  <div class="form-group row">
521  <label for="id_4" class="control-label col-sm-4 col-md-3 col-lg-2">tst_highscore_anon</label>
522  <div class="col-sm-8 col-md-9 col-lg-10">
523  <input type="checkbox" id="id_4" value="checked" checked="checked" name="" class="form-control form-control-sm" />
524  <div class="help-block">tst_highscore_anon_description</div>
525  </div>
526  </div>
527  <div class="form-group row">
528  <label for="id_5" class="control-label col-sm-4 col-md-3 col-lg-2">tst_highscore_achieved_ts</label>
529  <div class="col-sm-8 col-md-9 col-lg-10">
530  <input type="checkbox" id="id_5" value="checked" checked="checked" name="" class="form-control form-control-sm" />
531  <div class="help-block">tst_highscore_achieved_ts_description</div>
532  </div>
533  </div>
534  <div class="form-group row">
535  <label for="id_6" class="control-label col-sm-4 col-md-3 col-lg-2">tst_highscore_score</label>
536  <div class="col-sm-8 col-md-9 col-lg-10">
537  <input type="checkbox" id="id_6" value="checked" checked="checked" name="" class="form-control form-control-sm" />
538  <div class="help-block">tst_highscore_score_description</div>
539  </div>
540  </div>
541  <div class="form-group row">
542  <label for="id_7" class="control-label col-sm-4 col-md-3 col-lg-2">tst_highscore_percentage</label>
543  <div class="col-sm-8 col-md-9 col-lg-10">
544  <input type="checkbox" id="id_7" value="checked" checked="checked" name="" class="form-control form-control-sm" />
545  <div class="help-block">tst_highscore_percentage_description</div>
546  </div>
547  </div>
548  <div class="form-group row">
549  <label for="id_8" class="control-label col-sm-4 col-md-3 col-lg-2">tst_highscore_hints</label>
550  <div class="col-sm-8 col-md-9 col-lg-10">
551  <input type="checkbox" id="id_8" value="checked" checked="checked" name="" class="form-control form-control-sm" />
552  <div class="help-block">tst_highscore_hints_description</div>
553  </div>
554  </div>
555  <div class="form-group row">
556  <label for="id_9" class="control-label col-sm-4 col-md-3 col-lg-2">tst_highscore_wtime</label>
557  <div class="col-sm-8 col-md-9 col-lg-10">
558  <input type="checkbox" id="id_9" value="checked" checked="checked" name="" class="form-control form-control-sm" />
559  <div class="help-block">tst_highscore_wtime_description</div>
560  </div>
561  </div>
562 
563  </div>
564 
565  </div>
566 </div>
567 EOT;
568 
569  $this->assertHTMLEquals(
570  $this->brutallyTrimHTML($expected),
571  $this->brutallyTrimHTML($this->brutallyTrimSignals($actual))
572  );
573  }
574 
576  {
577  $id = -666;
578  $s = new ilObjTestScoreSettings(
579  $id,
584  );
585 
586  $t = new class ($s) extends ilObjTest {
587  public function __construct($s)
588  {
589  $this->score_settings = $s;
590  }
591  };
592 
593  $this->assertIsInt($t->getCountSystem());
594  $this->assertIsInt($t->getScoreCutting());
595  $this->assertIsInt($t->getPassScoring());
596  $this->assertNull($t->getReportingDate());
597  $this->assertIsBool($t->getShowPassDetails());
598  $this->assertIsBool($t->getShowSolutionDetails());
599  $this->assertIsBool($t->getShowSolutionAnswersOnly());
600  $this->assertIsBool($t->getShowSolutionSignature());
601  $this->assertIsBool($t->getShowSolutionSuggested());
602  $this->assertIsBool($t->getShowSolutionListComparison());
603  $this->assertIsBool($t->getShowSolutionListOwnAnswers());
604  $this->assertIsBool($t->isPassDeletionAllowed());
605  $this->assertIsInt($t->getExportSettings());
606  $this->assertIsBool($t->getExportSettingsSingleChoiceShort());
607  $this->assertIsBool($t->getHighscoreEnabled());
608  $this->assertIsBool($t->getHighscoreAnon());
609  $this->assertIsBool($t->getHighscoreAchievedTS());
610  $this->assertIsBool($t->getHighscoreScore());
611  $this->assertIsBool($t->getHighscorePercentage());
612  $this->assertIsBool($t->getHighscoreHints());
613  $this->assertIsBool($t->getHighscoreWTime());
614  $this->assertIsBool($t->getHighscoreOwnTable());
615  $this->assertIsBool($t->getHighscoreTopTable());
616  $this->assertIsInt($t->getHighscoreTopNum());
617  $this->assertIsInt($t->getHighscoreMode());
618  }
619 
620  public function testScoreSettingsRelayingTestId(): void
621  {
622  $id = -666;
623  $s = new ilObjTestScoreSettings(
624  $id,
629  );
630 
631  $nu_id = 1234;
632  $s = $s->withTestId($nu_id);
633  $this->assertEquals($nu_id, $s->getTestId());
634  $this->assertEquals($nu_id, $s->getScoringSettings()->getTestId());
635  $this->assertEquals($nu_id, $s->getResultSummarySettings()->getTestId());
636  $this->assertEquals($nu_id, $s->getResultDetailsSettings()->getTestId());
637  $this->assertEquals($nu_id, $s->getGamificationSettings()->getTestId());
638  }
639 }
This is what a factory for input fields looks like.
Definition: Factory.php:28
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:355
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class Factory.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ChatMainBarProvider .
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:444
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
Definition: Base.php:427
Provides common functionality for UI tests.
Definition: Base.php:298
__construct(Container $dic, ilPlugin $plugin)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
brutallyTrimSignals(string $html)
A naive replacement of all il_signal-ids with dots to ease comparisons of rendered output...
Definition: Base.php:459
$factory
Definition: metadata.php:75
Refinery Factory $refinery