You are here

public function TimeTest::testGetRequestTimeNoRequest in Drupal 9

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

@covers ::getRequestTime

File

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

Class

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

Namespace

Drupal\Tests\Component\Datetime

Code

public function testGetRequestTimeNoRequest() {
  $expected = 12345678;
  unset($_SERVER['REQUEST_TIME']);
  $this
    ->assertEquals($expected, $this->time
    ->getRequestTime());
  $_SERVER['REQUEST_TIME'] = 23456789;
  $this
    ->assertEquals(23456789, $this->time
    ->getRequestTime());
}