public function TimeMachine::setTime in Preview Link 2.x
Same name and namespace in other branches
- 2.0.x tests/modules/preview_link_test_time/src/TimeMachine.php \Drupal\preview_link_test_time\TimeMachine::setTime()
Sets time.
Parameters
\DateTimeInterface $dateTime: Sets the time.
File
- tests/
modules/ preview_link_test_time/ src/ TimeMachine.php, line 66
Class
- TimeMachine
- Service used to simulate time.
Namespace
Drupal\preview_link_test_timeCode
public function setTime(\DateTimeInterface $dateTime) {
if ($dateTime instanceof \DateTime) {
$dateTime = \DateTimeImmutable::createFromMutable($dateTime);
}
$this->state
->set('preview_link_test_time_machine', $dateTime);
}