function TimeWithNoRequestTest::testGetRequestTimeImmutable

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

Tests the getRequestTime method.

@covers ::getRequestTime

File

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

Class

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

Namespace

Drupal\Tests\Component\Datetime

Code

public function testGetRequestTimeImmutable() : void {
    $requestTime = $this->time
        ->getRequestTime();
    sleep(2);
    $this->assertSame($requestTime, $this->time
        ->getRequestTime());
}

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