class TestTime in Drupal 8
Same name and namespace in other branches
- 9 core/modules/update/tests/modules/update_test/src/Datetime/TestTime.php \Drupal\update_test\Datetime\TestTime
Test service for altering the request time.
Hierarchy
- class \Drupal\Component\Datetime\Time implements TimeInterface- class \Drupal\update_test\Datetime\TestTime
 
Expanded class hierarchy of TestTime
1 string reference to 'TestTime'
- update_test.services.yml in core/modules/ update/ tests/ modules/ update_test/ update_test.services.yml 
- core/modules/update/tests/modules/update_test/update_test.services.yml
1 service uses TestTime
- datetime.time in core/modules/ update/ tests/ modules/ update_test/ update_test.services.yml 
- Drupal\update_test\Datetime\TestTime
File
- core/modules/ update/ tests/ modules/ update_test/ src/ Datetime/ TestTime.php, line 10 
Namespace
Drupal\update_test\DatetimeView source
class TestTime extends Time {
  /**
   * {@inheritdoc}
   */
  public function getRequestTime() {
    if ($mock_date = \Drupal::state()
      ->get('update_test.mock_date', NULL)) {
      return \DateTime::createFromFormat('Y-m-d', $mock_date)
        ->getTimestamp();
    }
    return parent::getRequestTime();
  }
}Members
| Name   | Modifiers | Type | Description | Overrides | 
|---|---|---|---|---|
| TestTime:: | public | function | Returns the timestamp for the current request. Overrides Time:: | |
| Time:: | protected | property | The request stack. | |
| Time:: | public | function | Returns the current system time with microsecond precision. Overrides TimeInterface:: | |
| Time:: | public | function | Returns the current system time as an integer. Overrides TimeInterface:: | |
| Time:: | public | function | Returns the timestamp for the current request with microsecond precision. Overrides TimeInterface:: | |
| Time:: | public | function | Constructs a Time object. | 
