19declare(strict_types=1);
21require_once(__DIR__ .
"/../../../../UI/tests/Base.php");
22require_once(__DIR__ .
"/../../../../UI/tests/Component/Input/Field/CommonFieldRendering.php");
36 use CommonFieldRendering;
43 new SettingsScoring(),
48 $this->assertInstanceOf(ScoreSettings::class, $s);
49 $this->assertInstanceOf(SettingsScoring::class, $s->getScoringSettings());
50 $this->assertInstanceOf(SettingsResultSummary::class, $s->getResultSummarySettings());
51 $this->assertInstanceOf(SettingsResultDetails::class, $s->getResultDetailsSettings());
52 $this->assertInstanceOf(SettingsGamification::class, $s->getGamificationSettings());
57 $s =
new SettingsScoring();
58 $this->assertEquals(2, $s->withCountSystem(2)->getCountSystem());
59 $this->assertEquals(4, $s->withScoreCutting(4)->getScoreCutting());
60 $this->assertEquals(5, $s->withPassScoring(5)->getPassScoring());
65 $dat = new \DateTimeImmutable();
68 ScoreReportingTypes::SCORE_REPORTING_AFTER_PASSED,
69 $s->withScoreReporting(ScoreReportingTypes::SCORE_REPORTING_AFTER_PASSED)->getScoreReporting()
71 $this->assertTrue($s->withShowGradingStatusEnabled(
true)->getShowGradingStatusEnabled());
72 $this->assertFalse($s->withShowGradingStatusEnabled(
false)->getShowGradingStatusEnabled());
73 $this->assertTrue($s->withShowGradingMarkEnabled(
true)->getShowGradingMarkEnabled());
74 $this->assertFalse($s->withShowGradingMarkEnabled(
false)->getShowGradingMarkEnabled());
75 $this->assertTrue($s->withPassDeletionAllowed(
true)->getPassDeletionAllowed());
76 $this->assertFalse($s->withPassDeletionAllowed(
false)->getPassDeletionAllowed());
77 $this->assertTrue($s->withShowPassDetails(
true)->getShowPassDetails());
78 $this->assertFalse($s->withShowPassDetails(
false)->getShowPassDetails());
84 $this->assertEquals(192, $s->withResultsPresentation(192)->getResultsPresentation(192));
85 $this->assertTrue($s->withShowExamIdInTestResults(
true)->getShowExamIdInTestResults());
86 $this->assertTrue($s->withShowPassDetails(
true)->getShowPassDetails());
87 $this->assertFalse($s->withShowPassDetails(
false)->getShowPassDetails());
88 $this->assertTrue($s->withShowSolutionPrintview(
true)->getShowSolutionPrintview());
89 $this->assertFalse($s->withShowSolutionPrintview(
false)->getShowSolutionPrintview());
90 $this->assertTrue($s->withShowSolutionFeedback(
true)->getShowSolutionFeedback());
91 $this->assertFalse($s->withShowSolutionFeedback(
false)->getShowSolutionFeedback());
92 $this->assertTrue($s->withShowSolutionAnswersOnly(
true)->getShowSolutionAnswersOnly());
93 $this->assertFalse($s->withShowSolutionAnswersOnly(
false)->getShowSolutionAnswersOnly());
94 $this->assertTrue($s->withShowSolutionSignature(
true)->getShowSolutionSignature());
95 $this->assertFalse($s->withShowSolutionSignature(
false)->getShowSolutionSignature());
96 $this->assertTrue($s->withShowSolutionSuggested(
true)->getShowSolutionSuggested());
97 $this->assertFalse($s->withShowSolutionSuggested(
false)->getShowSolutionSuggested());
98 $this->assertTrue($s->withShowSolutionListComparison(
true)->getShowSolutionListComparison());
99 $this->assertFalse($s->withShowSolutionListComparison(
false)->getShowSolutionListComparison());
100 $this->assertTrue($s->withShowPassDetails(
true)->getShowPassDetails());
106 $this->assertTrue($s->withHighscoreEnabled(
true)->getHighscoreEnabled());
107 $this->assertFalse($s->withHighscoreEnabled(
false)->getHighscoreEnabled());
108 $this->assertTrue($s->withHighscoreAnon(
true)->getHighscoreAnon());
109 $this->assertFalse($s->withHighscoreAnon(
false)->getHighscoreAnon());
110 $this->assertTrue($s->withHighscoreAchievedTS(
true)->getHighscoreAchievedTS());
111 $this->assertFalse($s->withHighscoreAchievedTS(
false)->getHighscoreAchievedTS());
112 $this->assertTrue($s->withHighscoreScore(
true)->getHighscoreScore());
113 $this->assertFalse($s->withHighscoreScore(
false)->getHighscoreScore());
114 $this->assertTrue($s->withHighscorePercentage(
true)->getHighscorePercentage());
115 $this->assertFalse($s->withHighscorePercentage(
false)->getHighscorePercentage());
116 $this->assertTrue($s->withHighscoreWTime(
true)->getHighscoreWTime());
117 $this->assertFalse($s->withHighscoreWTime(
false)->getHighscoreWTime());
118 $this->assertTrue($s->withHighscoreOwnTable(
true)->getHighscoreOwnTable());
119 $this->assertFalse($s->withHighscoreOwnTable(
false)->getHighscoreOwnTable());
120 $this->assertTrue($s->withHighscoreTopTable(
true)->getHighscoreTopTable());
121 $this->assertFalse($s->withHighscoreTopTable(
false)->getHighscoreTopTable());
122 $this->assertEquals(15, $s->withHighscoreTopNum(15)->getHighscoreTopNum());
129 $this->getFieldFactory(),
136 $s =
new SettingsScoring(666);
137 $actual = $this->render(
138 $s->toForm(...$this->getUIPack())
141 $i1 = $this->getFormWrappedHtml(
143 'tst_text_count_system',
145 <div class="c-field-radio">
146 <div class="c-field-radio__item">
147 <input type="radio" id="id_1_0_opt" value="0" checked="checked" />
148 <label for="id_1_0_opt">tst_count_partial_solutions</label>
149 <div class="c-input__help-byline">tst_count_partial_solutions_desc</div>
152 <div class="c-field-radio__item">
153 <input type="radio" id="id_1_1_opt" value="1" />
154 <label for="id_1_1_opt">tst_count_correct_solutions</label>
155 <div class="c-input__help-byline">tst_count_correct_solutions_desc</div>
164 $i2 = $this->getFormWrappedHtml(
168 <div class="c-field-radio">
169 <div class="c-field-radio__item">
170 <input type="radio" id="id_2_0_opt" value="0" checked="checked" />
171 <label for="id_2_0_opt">tst_score_cut_question</label>
172 <div class="c-input__help-byline">tst_score_cut_question_desc</div>
175 <div class="c-field-radio__item">
176 <input type="radio" id="id_2_1_opt" value="1" />
177 <label for="id_2_1_opt">tst_score_cut_test</label>
178 <div class="c-input__help-byline">tst_score_cut_test_desc</div>
187 $i3 = $this->getFormWrappedHtml(
191 <div class="c-field-radio">
192 <div class="c-field-radio__item">
193 <input type="radio" id="id_3_0_opt" value="0" checked="checked" />
194 <label for="id_3_0_opt">tst_pass_last_pass</label>
195 <div class="c-input__help-byline">tst_pass_last_pass_desc</div>
198 <div class="c-field-radio__item">
199 <input type="radio" id="id_3_1_opt" value="1" />
200 <label for="id_3_1_opt">tst_pass_best_pass</label>
201 <div class="c-input__help-byline">tst_pass_best_pass_desc</div>
211 $expected = $this->getFormWrappedHtml(
212 'section-field-input',
220 $this->assertHTMLEquals($expected, $this->brutallyTrimSignals($actual));
230 new S\Icon\Factory(),
231 new S\Glyph\Factory(),
232 new S\Avatar\Factory()
240 $data_factory = new \ILIAS\Data\Factory();
242 $refinery = new \ILIAS\Refinery\Factory($data_factory, $language);
252 $ui = [$language, $field_factory,
$refinery];
255 $actual = $this->render(
256 $s->toForm(...array_merge($ui, [[
257 'user_time_zone' =>
'Europe/Berlin',
258 'user_date_format' => $data_factory->dateFormat()->withTime24(
259 $data_factory->dateFormat()->standard()
264 $i1_1_1 = $this->getFormWrappedHtml(
266 '<input type="radio" id="id_2" value="2" /><span>tst_results_access_always</span>',
268 'tst_results_access_always_desc',
273 $i1_1_2 = $this->getFormWrappedHtml(
275 '<input type="radio" id="id_3" value="1" /><span>tst_results_access_finished</span>',
277 'tst_results_access_finished_desc',
282 $i1_1_3 = $this->getFormWrappedHtml(
284 '<input type="radio" id="id_4" value="4" /><span>tst_results_access_passed</span>',
286 'tst_results_access_passed_desc',
292 $i1_1_4_1 = $this->getFormWrappedHtml(
293 'date-time-field-input',
294 'tst_reporting_date<span class="asterisk" aria-label="required_field">*</span>',
295 '<div class="c-input-group">
296 <input id="id_6" type="datetime-local" class="c-field-datetime" />
304 $i1_1_4 = $this->getFormWrappedHtml(
306 '<input type="radio" id="id_5" value="3" /><span>tst_results_access_date</span><span class="asterisk" aria-label="required_field">*</span>',
308 'tst_results_access_date_desc',
314 $i1_1 = $this->getFormWrappedHtml(
315 'switchable-group-field-input',
316 'tst_results_access_setting<span class="asterisk" aria-label="required_field">*</span>',
317 $i1_1_1 . $i1_1_2 . $i1_1_3 . $i1_1_4,
324 $i1_2 = $this->getFormWrappedHtml(
325 'checkbox-field-input',
326 'tst_results_grading_opt_show_status',
327 '<input type="checkbox" id="id_7" value="checked" class="c-field-checkbox" />',
328 'tst_results_grading_opt_show_status_desc',
333 $i1_3 = $this->getFormWrappedHtml(
334 'checkbox-field-input',
335 'tst_results_grading_opt_show_mark',
336 '<input type="checkbox" id="id_8" value="checked" class="c-field-checkbox" />',
337 'tst_results_grading_opt_show_mark_desc',
342 $i1_4 = $this->getFormWrappedHtml(
343 'checkbox-field-input',
344 'tst_results_grading_opt_show_details',
345 '<input type="checkbox" id="id_9" value="checked" class="c-field-checkbox" />',
346 'tst_results_grading_opt_show_details_desc',
351 $i1_5 = $this->getFormWrappedHtml(
352 'checkbox-field-input',
354 '<input type="checkbox" id="id_10" value="checked" class="c-field-checkbox" />',
355 'tst_pass_deletion_allowed',
361 $i1 = $this->getFormWrappedHtml(
362 'optional-group-field-input',
363 '<span>tst_results_access_enabled</span><input type="checkbox" id="id_1" value="checked" />',
364 $i1_1 . $i1_2 . $i1_3 . $i1_4 . $i1_5,
365 'tst_results_access_enabled_desc',
371 $expected = $this->getFormWrappedHtml(
372 'section-field-input',
380 $this->assertEquals($expected, $this->brutallyTrimSignals($actual));
388 $actual = $this->render(
392 [[
'taxonomy_options' => $tax_ids]]
397 [
'tst_results_print_best_solution',
'tst_results_print_best_solution_info'],
398 [
'tst_show_solution_feedback',
'tst_show_solution_feedback_desc'],
399 [
'tst_show_solution_suggested',
'tst_show_solution_suggested_desc'],
400 [
'tst_show_solution_printview',
'tst_show_solution_printview_desc'],
401 [
'tst_hide_pagecontents',
'tst_hide_pagecontents_desc'],
402 [
'tst_show_solution_signature',
'tst_show_solution_signature_desc'],
403 [
'examid_in_test_res',
'examid_in_test_res_desc'],
406 foreach ($opts as $index => $entry) {
407 list($label, $byline) = $entry;
408 $nr = (string) ($index + 1);
409 $checked = $index === 6 ?
' checked="checked"' :
'';
410 $field_html =
'<input type="checkbox" id="id_' . $nr .
'" value="checked"' . $checked .
' class="c-field-checkbox" />';
411 $options .= $this->getFormWrappedHtml(
412 'checkbox-field-input',
422 $expected = $this->getFormWrappedHtml(
423 'section-field-input',
424 'tst_results_details_options',
431 $this->assertEquals($expected, $this->brutallyTrimSignals($actual));
438 $actual = $this->render(
439 $s->toForm(...$this->getUIPack())
442 $fields = $this->getFormWrappedHtml(
444 'tst_highscore_mode<span class="asterisk" aria-label="required_field">*</span>',
445 '<div class="c-field-radio">
446 <div class="c-field-radio__item">
447 <input type="radio" id="id_2_1_opt" value="1" /><label for="id_2_1_opt">tst_highscore_own_table</label><div class="c-input__help-byline">tst_highscore_own_table_description</div>
449 <div class="c-field-radio__item">
450 <input type="radio" id="id_2_2_opt" value="2" /><label for="id_2_2_opt">tst_highscore_top_table</label><div class="c-input__help-byline">tst_highscore_top_table_description</div>
452 <div class="c-field-radio__item">
453 <input type="radio" id="id_2_3_opt" value="3" checked="checked" /><label for="id_2_3_opt">tst_highscore_all_tables</label><div class="c-input__help-byline">tst_highscore_all_tables_description</div>
461 $fields .= $this->getFormWrappedHtml(
462 'numeric-field-input',
463 'tst_highscore_top_num<span class="asterisk" aria-label="required_field">*</span>',
464 '<input id="id_3" type="number" step="1" value="10" class="c-field-number" />',
465 'tst_highscore_top_num_description',
473 [
'tst_highscore_anon',
'tst_highscore_anon_description'],
474 [
'tst_highscore_achieved_ts',
'tst_highscore_achieved_ts_description'],
475 [
'tst_highscore_score',
'tst_highscore_score_description'],
476 [
'tst_highscore_percentage',
'tst_highscore_percentage_description'],
477 [
'tst_highscore_wtime',
'tst_highscore_wtime_description']
479 foreach ($opts as $index => $entry) {
480 list($label, $byline) = $entry;
481 $nr = (string) ($index + 4);
482 $field_html =
'<input type="checkbox" id="id_' . $nr .
'" value="checked" checked="checked" class="c-field-checkbox" />';
483 $fields .= $this->getFormWrappedHtml(
484 'checkbox-field-input',
494 $group = $this->getFormWrappedHtml(
495 'optional-group-field-input',
496 '<span>tst_highscore_enabled</span><input type="checkbox" id="id_1" value="checked" />',
498 'tst_highscore_description',
504 $expected = $this->getFormWrappedHtml(
505 'section-field-input',
506 'tst_results_gamification',
513 $this->assertHTMLEquals($expected, $this->brutallyTrimSignals($actual));
520 new SettingsScoring(),
529 $this->score_settings = $s;
533 $this->assertIsInt($t->getCountSystem());
534 $this->assertIsInt($t->getScoreCutting());
535 $this->assertIsInt($t->getPassScoring());
536 $this->assertIsBool($t->getShowPassDetails());
537 $this->assertIsBool($t->getShowSolutionAnswersOnly());
538 $this->assertIsBool($t->getShowSolutionSignature());
539 $this->assertIsBool($t->getShowSolutionSuggested());
540 $this->assertIsBool($t->getShowSolutionListComparison());
541 $this->assertIsBool($t->isPassDeletionAllowed());
542 $this->assertIsInt($t->getExportSettings());
543 $this->assertIsBool($t->getHighscoreEnabled());
544 $this->assertIsBool($t->getHighscoreAnon());
545 $this->assertIsBool($t->getHighscoreAchievedTS());
546 $this->assertIsBool($t->getHighscoreScore());
547 $this->assertIsBool($t->getHighscorePercentage());
548 $this->assertIsBool($t->getHighscoreWTime());
549 $this->assertIsBool($t->getHighscoreOwnTable());
550 $this->assertIsBool($t->getHighscoreTopTable());
551 $this->assertIsInt($t->getHighscoreTopNum());
552 $this->assertIsInt($t->getHighscoreMode());
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
testScoreSettingsSectionGamification()
testScoreSettingsScoring()
testScoreSettingsDirectlyAccessedByTestObj()
testScoreSettingsGamification()
testScoreSettingsSummary()
testScoreSettingsSectionDetails()
testScoreSettingsDetails()
testScoreSettingsSectionSummary()
testScoreSettingsSectionScoring()
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.