You are here

public function TimeMachine::setTime in Preview Link 8

Sets time.

Parameters

\DateTimeInterface $dateTime: Sets the time.

File

tests/modules/preview_link_test/src/TimeMachine.php, line 64

Class

TimeMachine
Service used to simulate time.

Namespace

Drupal\preview_link_test

Code

public function setTime(\DateTimeInterface $dateTime) {
  if ($dateTime instanceof \DateTime) {
    $dateTime = \DateTimeImmutable::createFromMutable($dateTime);
  }
  $this->state
    ->set('preview_link_test_time_machine', $dateTime);
}