class TestTime

Same name in this branch
  1. 11.x core/modules/update/tests/modules/update_test/src/Datetime/TestTime.php \Drupal\update_test\Datetime\TestTime
Same name and namespace in other branches
  1. 9 core/modules/update/tests/modules/update_test/src/Datetime/TestTime.php \Drupal\update_test\Datetime\TestTime
  2. 8.9.x core/modules/update/tests/modules/update_test/src/Datetime/TestTime.php \Drupal\update_test\Datetime\TestTime
  3. 10 core/modules/update/tests/modules/update_test/src/Datetime/TestTime.php \Drupal\update_test\Datetime\TestTime

A test-only implementation of the time service.

Hierarchy

Expanded class hierarchy of TestTime

File

core/modules/package_manager/tests/src/Kernel/StageConflictTest.php, line 225

Namespace

Drupal\Tests\package_manager\Kernel
View source
class TestTime extends Time {
  
  /**
   * An offset to add to the request time.
   *
   * @var int
   */
  public static $offset = 0;
  
  /**
   * {@inheritdoc}
   */
  public function getRequestTime() {
    return parent::getRequestTime() + static::$offset;
  }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
TestTime::$offset public static property An offset to add to the request time.
TestTime::getRequestTime public function Returns the timestamp for the current request. Overrides Time::getRequestTime
Time::$proxyRequestTime protected property A proxied request time if the request time is not available.
Time::$requestStack protected property The request stack.
Time::getCurrentMicroTime public function Returns the current system time with microsecond precision. Overrides TimeInterface::getCurrentMicroTime
Time::getCurrentTime public function Returns the current system time as an integer. Overrides TimeInterface::getCurrentTime
Time::getProxyRequestMicroTime protected function Returns a mimic of the timestamp of the current request.
Time::getProxyRequestTime protected function Returns a mimic of the timestamp of the current request.
Time::getRequestMicroTime public function Returns the timestamp for the current request with microsecond precision. Overrides TimeInterface::getRequestMicroTime
Time::__construct public function Constructs a Time object.

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