From 61d0c28996d40a4342827a3976d2bfce2c5f17c0 Mon Sep 17 00:00:00 2001 From: Stephan Kergomard Date: Tue, 14 Nov 2023 15:57:21 +0100 Subject: [PATCH] Test: Fix Score Reporting Date See: https://mantis.ilias.de/view.php?id=38258 --- .../classes/ScoreReporting/ilObjTestSettingsResultSummary.php | 4 ++-- .../Test/classes/class.ilObjTestSettingsScoringResultsGUI.php | 2 +- Modules/Test/test/ScoreSettingsTest.php | 4 +--- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Modules/Test/classes/ScoreReporting/ilObjTestSettingsResultSummary.php b/Modules/Test/classes/ScoreReporting/ilObjTestSettingsResultSummary.php index 1e6a1adce077..9a4fbefdf1fa 100644 --- a/Modules/Test/classes/ScoreReporting/ilObjTestSettingsResultSummary.php +++ b/Modules/Test/classes/ScoreReporting/ilObjTestSettingsResultSummary.php @@ -66,7 +66,7 @@ function ($v) { if ($reporting_date !== null) { $reporting_date = $reporting_date->setTimezone( new DateTimeZone($environment['user_time_zone']) - )->format($environment['user_date_format']); + )->format($environment['user_date_format']->toString() . ' H:m'); } $results_time_group = $f->switchableGroup( @@ -79,6 +79,7 @@ function ($v) { $f->dateTime($lng->txt('tst_reporting_date'), "") ->withTimezone($environment['user_time_zone']) ->withUseTime(true) + ->withFormat($environment['user_date_format']) ->withValue( $reporting_date ) @@ -98,7 +99,6 @@ function ($v) { $results_time_group = $results_time_group->withValue($this->getScoreReporting()); } - $optional_group = $f->optionalGroup( [ 'score_reporting_mode' => $results_time_group, diff --git a/Modules/Test/classes/class.ilObjTestSettingsScoringResultsGUI.php b/Modules/Test/classes/class.ilObjTestSettingsScoringResultsGUI.php index c0804df46c15..b3893242b90d 100644 --- a/Modules/Test/classes/class.ilObjTestSettingsScoringResultsGUI.php +++ b/Modules/Test/classes/class.ilObjTestSettingsScoringResultsGUI.php @@ -239,7 +239,7 @@ private function buildForm(): Form default: $date_format = $df->standard(); } - $environment['user_date_format'] = $date_format->toString() . 'H:i'; + $environment['user_date_format'] = $date_format; $environment['user_time_zone'] = $this->active_user->getTimeZone(); $disabled_flag = ($this->areScoringSettingsWritable() === false); diff --git a/Modules/Test/test/ScoreSettingsTest.php b/Modules/Test/test/ScoreSettingsTest.php index e32db4997cb0..5ad3f0ea5d72 100644 --- a/Modules/Test/test/ScoreSettingsTest.php +++ b/Modules/Test/test/ScoreSettingsTest.php @@ -261,9 +261,7 @@ public function testScoreSettingsSectionSummary(): void $actual = $this->getDefaultRenderer()->render( $s->toForm(...array_merge($ui, [[ 'user_time_zone' => 'Europe/Berlin', - 'user_date_format' => $data_factory->dateFormat()->withTime24( - $data_factory->dateFormat()->standard() - ) + 'user_date_format' => $data_factory->dateFormat()->standard() ]])) );