TestTime.php in Drupal 10
File
core/modules/update/tests/modules/update_test/src/Datetime/TestTime.php
View source
<?php
namespace Drupal\update_test\Datetime;
use Drupal\Component\Datetime\Time;
class TestTime extends Time {
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();
}
}
Classes
Name |
Description |
TestTime |
Test service for altering the request time. |