You are here

public function TimeTest::testGetRequestMicroTimeNoRequest in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Component/Datetime/TimeTest.php \Drupal\Tests\Component\Datetime\TimeTest::testGetRequestMicroTimeNoRequest()
  2. 9 core/tests/Drupal/Tests/Component/Datetime/TimeTest.php \Drupal\Tests\Component\Datetime\TimeTest::testGetRequestMicroTimeNoRequest()

@covers ::getRequestMicroTime

File

core/tests/Drupal/Tests/Component/Datetime/TimeTest.php, line 96

Class

TimeTest
@coversDefaultClass \Drupal\Component\Datetime\Time @group Datetime

Namespace

Drupal\Tests\Component\Datetime

Code

public function testGetRequestMicroTimeNoRequest() {
  $expected = 1234567.89;
  unset($_SERVER['REQUEST_TIME_FLOAT']);
  $this
    ->assertEquals($expected, $this->time
    ->getRequestMicroTime());
  $_SERVER['REQUEST_TIME_FLOAT'] = 2345678.9;
  $this
    ->assertEquals(2345678.9, $this->time
    ->getRequestMicroTime());
}