function TimeTest::testGetRequestTimeNoRequest

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Component/Datetime/TimeTest.php \Drupal\Tests\Component\Datetime\TimeTest::testGetRequestTimeNoRequest()
  2. 10 core/tests/Drupal/Tests/Component/Datetime/TimeTest.php \Drupal\Tests\Component\Datetime\TimeTest::testGetRequestTimeNoRequest()
  3. 11.x 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());
}

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