Skip to content

Commit

Permalink
Test: Fix Score Reporting Date
Browse files Browse the repository at this point in the history
  • Loading branch information
kergomard committed Nov 14, 2023
1 parent b730108 commit 61d0c28
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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
)
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 1 addition & 3 deletions Modules/Test/test/ScoreSettingsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
]]))
);

Expand Down

0 comments on commit 61d0c28

Please sign in to comment.