function TestTime::getRequestTime
Same name in other branches
- 8.9.x core/modules/update/tests/modules/update_test/src/Datetime/TestTime.php \Drupal\update_test\Datetime\TestTime::getRequestTime()
- 10 core/modules/update/tests/modules/update_test/src/Datetime/TestTime.php \Drupal\update_test\Datetime\TestTime::getRequestTime()
- 11.x core/modules/update/tests/modules/update_test/src/Datetime/TestTime.php \Drupal\update_test\Datetime\TestTime::getRequestTime()
- 11.x core/modules/package_manager/tests/src/Kernel/StageConflictTest.php \Drupal\Tests\package_manager\Kernel\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.