本文整理匯總了PHP中Cake\I18n\Time::setTestNow方法的典型用法代碼示例。如果您正苦於以下問題:PHP Time::setTestNow方法的具體用法?PHP Time::setTestNow怎麽用?PHP Time::setTestNow使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Cake\I18n\Time
的用法示例。
在下文中一共展示了Time::setTestNow方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: tearDown
/**
* tearDown method
*
* @return void
*/
public function tearDown()
{
parent::tearDown();
Time::setTestNow($this->now);
Time::$defaultLocale = $this->locale;
Time::resetToStringFormat();
FrozenTime::setTestNow($this->frozenNow);
FrozenTime::$defaultLocale = $this->locale;
FrozenTime::resetToStringFormat();
date_default_timezone_set('UTC');
}
示例2: tearDown
/**
* tearDown method
*
* @return void
*/
public function tearDown()
{
parent::tearDown();
Time::setTestNow($this->now);
Time::setDefaultLocale($this->locale);
Time::resetToStringFormat();
FrozenTime::setTestNow($this->frozenNow);
FrozenTime::setDefaultLocale($this->locale);
FrozenTime::resetToStringFormat();
date_default_timezone_set('UTC');
I18n::locale(I18n::DEFAULT_LOCALE);
}
示例3: testIsThisYear
/**
* testIsThisYear method
*
* @return void
*/
public function testIsThisYear()
{
$time = new Time();
$this->assertTrue($time->isThisYear());
$time->year = $time->year + 1;
$this->assertFalse($time->isThisYear());
$thisYear = date('Y');
$time = new Time("{$thisYear}-01-01 00:00", 'Australia/Sydney');
$now = clone $time;
$now->timezone('UTC');
Time::setTestNow($now);
$this->assertFalse($time->isThisYear());
}
示例4: tearDown
/**
* tearDown method
*
* @return void
*/
public function tearDown()
{
unset($this->User);
Time::setTestNow();
parent::tearDown();
}