class TestTimeService in Search API 8
Provides a dummy time service that can be used for testing.
Hierarchy
- class \Drupal\Component\Datetime\Time implements TimeInterface
- class \Drupal\Tests\search_api\Kernel\TestTimeService
Expanded class hierarchy of TestTimeService
File
- tests/
src/ Kernel/ TestTimeService.php, line 10
Namespace
Drupal\Tests\search_api\KernelView source
class TestTimeService extends Time {
/**
* The request time to return.
*
* @var int
*
* @see \Drupal\Tests\search_api\Kernel\TestTimeService::getRequestTime()
*/
protected $requestTime;
/**
* Constructs a TestTimeService object.
*/
public function __construct() {
$this->requestTime = time();
}
/**
* {@inheritdoc}
*/
public function getRequestTime() {
return $this->requestTime;
}
/**
* Advances the reported request time.
*
* @param int $seconds
* (optional) Number of seconds by which to advance the reported request
* time.
*
* @return $this
*/
public function advanceTime($seconds = 1) {
$this->requestTime += $seconds;
return $this;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
TestTimeService:: |
protected | property | The request time to return. | |
TestTimeService:: |
public | function | Advances the reported request time. | |
TestTimeService:: |
public | function |
Returns the timestamp for the current request. Overrides Time:: |
|
TestTimeService:: |
public | function |
Constructs a TestTimeService object. 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:: |