function TimeWithNoRequestTest::testGetRequestMicroTimeImmutable

Same name in other branches
  1. 11.x core/tests/Drupal/Tests/Component/Datetime/TimeWithNoRequestTest.php \Drupal\Tests\Component\Datetime\TimeWithNoRequestTest::testGetRequestMicroTimeImmutable()

Tests the getRequestMicroTime method.

@covers ::getRequestMicroTime

File

core/tests/Drupal/Tests/Component/Datetime/TimeWithNoRequestTest.php, line 55

Class

TimeWithNoRequestTest
Tests that getRequest(Micro)Time works when no underlying request exists.

Namespace

Drupal\Tests\Component\Datetime

Code

public function testGetRequestMicroTimeImmutable() : void {
    $requestTime = $this->time
        ->getRequestMicroTime();
    usleep(20000);
    $this->assertSame($requestTime, $this->time
        ->getRequestMicroTime());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.