function TimeTest::testGetRequestMicroTime
Same name and namespace in other branches
- 8.9.x core/tests/Drupal/Tests/Component/Datetime/TimeTest.php \Drupal\Tests\Component\Datetime\TimeTest::testGetRequestMicroTime()
- 10 core/tests/Drupal/Tests/Component/Datetime/TimeTest.php \Drupal\Tests\Component\Datetime\TimeTest::testGetRequestMicroTime()
- 11.x core/tests/Drupal/Tests/Component/Datetime/TimeTest.php \Drupal\Tests\Component\Datetime\TimeTest::testGetRequestMicroTime()
Tests the getRequestMicroTime method.
@covers ::getRequestMicroTime
File
-
core/
tests/ Drupal/ Tests/ Component/ Datetime/ TimeTest.php, line 68
Class
- TimeTest
- @coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Component%21Datetime%21Time.php/class/Time/9" title="Provides a class for obtaining system time." class="local">\Drupal\Component\Datetime\Time</a> @group Datetime
Namespace
Drupal\Tests\Component\DatetimeCode
public function testGetRequestMicroTime() {
$expected = 1234567.89;
$request = Request::createFromGlobals();
$request->server
->set('REQUEST_TIME_FLOAT', $expected);
// Mocks a the request stack getting the current request.
$this->requestStack
->expects($this->any())
->method('getCurrentRequest')
->willReturn($request);
$this->assertEquals($expected, $this->time
->getRequestMicroTime());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.