Skip to content

Commit

Permalink
[BUGFIX] Fix Typo3DbQueryParserTest for custom php timezones
Browse files Browse the repository at this point in the history
The test setup used to initialize the DateAspect from a string,
that means the local php timezone has been taken into account,
and test verficiation fails with date offsets if the local
timezone is not UTC.

Adapt to initialize from a unix timestamp, as this ensures
the local timezone has no effect on the test. Note that the
real application does the same, as the DateAspect in initialized
from the timestamp in GLOBALS['EXEC_TIME'].

Releases: master, 10.4, 9.5
Resolves: #94135
Change-Id: I0494ac3e1911f34a3a79c3063caaabad1c0027b7
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/69125
Tested-by: core-ci <[email protected]>
Tested-by: Oliver Bartsch <[email protected]>
Reviewed-by: Oliver Bartsch <[email protected]>
  • Loading branch information
bnf authored and o-ba committed May 13, 2021
1 parent 2653515 commit cb71f06
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ public function visibilityConstraintStatementIsGeneratedAccordingToTheQuerySetti
// simulate time for backend enable fields
$GLOBALS['SIM_ACCESS_TIME'] = 1451779200;
// simulate time for frontend (PageRepository) enable fields
$dateAspect = new DateTimeAspect(new \DateTimeImmutable('3.1.2016'));
$dateAspect = new DateTimeAspect(new \DateTimeImmutable('@1451779200'));
$context = new Context(['date' => $dateAspect]);
GeneralUtility::setSingletonInstance(Context::class, $context);

Expand Down Expand Up @@ -702,7 +702,7 @@ public function respectEnableFieldsSettingGeneratesCorrectStatement($mode, $resp
// simulate time for backend enable fields
$GLOBALS['SIM_ACCESS_TIME'] = 1451779200;
// simulate time for frontend (PageRepository) enable fields
$dateAspect = new DateTimeAspect(new \DateTimeImmutable('3.1.2016'));
$dateAspect = new DateTimeAspect(new \DateTimeImmutable('@1451779200'));
$context = new Context(['date' => $dateAspect]);
GeneralUtility::setSingletonInstance(Context::class, $context);

Expand Down

0 comments on commit cb71f06

Please sign in to comment.