TimeChanger.php in Content locking (anti-concurrent editing) 8.2
File
modules/content_lock_timeout/tests/modules/content_lock_timeout_test/src/TimeChanger.php
View source
<?php
namespace Drupal\content_lock_timeout_test;
use Drupal\Component\Datetime\Time;
class TimeChanger extends Time {
protected $overwrittenTime = NULL;
public function getCurrentTime() {
$time = \Drupal::keyValue('time')
->get('time', NULL);
if (!empty($time)) {
return $time;
}
return parent::getCurrentTime();
}
public function setCurrentTime($time) {
\Drupal::keyValue('time')
->set('time', $time);
}
public function resetCurrentTime() {
\Drupal::keyValue('time')
->delete('time');
}
public function getRequestTime() {
$time = \Drupal::keyValue('time')
->get('time', NULL);
if (!empty($time)) {
return $time;
}
return parent::getRequestTime();
}
}
Classes
Name |
Description |
TimeChanger |
This is a datetime.time service for testing only. |