function TestTime::getRequestTime
Overrides Time::getRequestTime
File
-
core/
modules/ update/ tests/ modules/ update_test/ src/ Datetime/ TestTime.php, line 15
Class
- TestTime
- Test service for altering the request time.
Namespace
Drupal\update_test\DatetimeCode
public function getRequestTime() {
if ($mock_date = \Drupal::state()->get('update_test.mock_date', NULL)) {
return \DateTime::createFromFormat('Y-m-d', $mock_date)->getTimestamp();
}
return parent::getRequestTime();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.