class TestTime
Same name in other branches
- 9 core/modules/update/tests/modules/update_test/src/Datetime/TestTime.php \Drupal\update_test\Datetime\TestTime
- 8.9.x core/modules/update/tests/modules/update_test/src/Datetime/TestTime.php \Drupal\update_test\Datetime\TestTime
- 11.x core/modules/update/tests/modules/update_test/src/Datetime/TestTime.php \Drupal\update_test\Datetime\TestTime
Test service for altering the request time.
Hierarchy
- class \Drupal\update_test\Datetime\TestTime extends \Drupal\Component\Datetime\Time
Expanded class hierarchy of TestTime
1 string reference to 'TestTime'
- update_test.services.yml in core/
modules/ update/ tests/ modules/ update_test/ update_test.services.yml - core/modules/update/tests/modules/update_test/update_test.services.yml
1 service uses TestTime
- datetime.time in core/
modules/ update/ tests/ modules/ update_test/ update_test.services.yml - Drupal\update_test\Datetime\TestTime
File
-
core/
modules/ update/ tests/ modules/ update_test/ src/ Datetime/ TestTime.php, line 10
Namespace
Drupal\update_test\DatetimeView source
class TestTime extends Time {
/**
* {@inheritdoc}
*/
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();
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title |
---|---|---|---|---|
TestTime::getRequestTime | public | function | Overrides Time::getRequestTime | |
Time::$proxyRequestTime | protected | property | A proxied request time if the request time is not available. | |
Time::$requestStack | protected | property | The request stack. | |
Time::getCurrentMicroTime | public | function | ||
Time::getCurrentTime | public | function | ||
Time::getProxyRequestMicroTime | protected | function | Returns a mimic of the timestamp of the current request. | |
Time::getProxyRequestTime | protected | function | Returns a mimic of the timestamp of the current request. | |
Time::getRequestMicroTime | public | function | ||
Time::__construct | public | function | Constructs a Time object. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.