Skip to content

Commit

Permalink
[BUGFIX] Make DateViewHelperTests resilient to execution time
Browse files Browse the repository at this point in the history
Executing the tests over midnight caused the changed tests to fail
as those where comparing the "current date" from the test subject
with the one gathered within the tests, those not necessarily
are on the same day.

As the DateViewHelper uses the date from the Context we
safely can use the EXEC_TIME of the Core for the expectation.

Resolves: #90752
Releases: master, 9.5
Change-Id: I3334f0fc5c3d956a4f6801a3bcd849f7f6585497
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/63737
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Susanne Moog <look@susi.dev>
Reviewed-by: Susanne Moog <look@susi.dev>
  • Loading branch information
liayn authored and susannemoog committed Mar 15, 2020
1 parent d0bc927 commit 6cb6827
Showing 1 changed file with 4 additions and 4 deletions.
Expand Up @@ -148,8 +148,8 @@ public function viewHelperReturnsCurrentDateIfEmptyStringIsGiven()
]
);
$actualResult = $this->viewHelper->initializeArgumentsAndRender();
$expectedResult = (new \DateTime())->format('Y-m-d');
$this->assertEquals($expectedResult, $actualResult);
$expectedResult = date('Y-m-d', $GLOBALS['EXEC_TIME']);
self::assertEquals($expectedResult, $actualResult);
}

/**
Expand All @@ -168,8 +168,8 @@ function () {
]
);
$actualResult = $this->viewHelper->initializeArgumentsAndRender();
$expectedResult = (new \DateTime())->format('Y-m-d');
$this->assertEquals($expectedResult, $actualResult);
$expectedResult = date('Y-m-d', $GLOBALS['EXEC_TIME']);
self::assertEquals($expectedResult, $actualResult);
}

/**
Expand Down

0 comments on commit 6cb6827

Please sign in to comment.