function TimeWithNoRequestTest::setUp
Same name in other branches
- 11.x core/tests/Drupal/Tests/Component/Datetime/TimeWithNoRequestTest.php \Drupal\Tests\Component\Datetime\TimeWithNoRequestTest::setUp()
File
-
core/
tests/ Drupal/ Tests/ Component/ Datetime/ TimeWithNoRequestTest.php, line 28
Class
- TimeWithNoRequestTest
- Tests that getRequest(Micro)Time works when no underlying request exists.
Namespace
Drupal\Tests\Component\DatetimeCode
protected function setUp() : void {
parent::setUp();
// We need to explicitly unset the $_SERVER variables, so that Time is
// forced to look for current time.
unset($_SERVER['REQUEST_TIME']);
unset($_SERVER['REQUEST_TIME_FLOAT']);
$this->time = new Time();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.