TestTime.php
Same filename in other branches
Namespace
Drupal\update_test\DatetimeFile
-
core/
modules/ update/ tests/ modules/ update_test/ src/ Datetime/ TestTime.php
View source
<?php
namespace Drupal\update_test\Datetime;
use Drupal\Component\Datetime\Time;
/**
* Test service for altering the request time.
*/
class TestTime extends Time {
/**
* {@inheritdoc}
*/
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
Title | Deprecated | Summary |
---|---|---|
TestTime | Test service for altering the request time. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.