mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-21 19:19:12 +01:00
Summary: Ref T4103. These are currently stored on the user, for historic/performance reasons. Since I want administrators to be able to set defaults for translations and timezones at a minimum and there's no longer a meaningful performance penalty for moving them off the user record, turn them into real preferences and then nuke the columns. Test Plan: - Set settings to unusual values. - Ran migrations. - Verified my unusual settings survived. - Created a new user. - Edited all settings with old and new UIs. - Reconciled client/server timezone disagreement. Reviewers: chad Reviewed By: chad Maniphest Tasks: T4103 Differential Revision: https://secure.phabricator.com/D16005
62 lines
1.4 KiB
PHP
62 lines
1.4 KiB
PHP
<?php
|
|
|
|
final class CalendarTimeUtilTestCase extends PhabricatorTestCase {
|
|
|
|
public function testTimestampsAtMidnight() {
|
|
$u = new PhabricatorUser();
|
|
$u->overrideTimezoneIdentifier('America/Los_Angeles');
|
|
$days = $this->getAllDays();
|
|
foreach ($days as $day) {
|
|
$data = CalendarTimeUtil::getCalendarWidgetTimestamps(
|
|
$u,
|
|
$day);
|
|
|
|
$this->assertEqual(
|
|
'000000',
|
|
$data['epoch_stamps'][0]->format('His'));
|
|
}
|
|
}
|
|
|
|
public function testTimestampsStartDay() {
|
|
$u = new PhabricatorUser();
|
|
$u->overrideTimezoneIdentifier('America/Los_Angeles');
|
|
$days = $this->getAllDays();
|
|
foreach ($days as $day) {
|
|
$data = CalendarTimeUtil::getTimestamps(
|
|
$u,
|
|
$day,
|
|
1);
|
|
|
|
$this->assertEqual(
|
|
$day,
|
|
$data['epoch_stamps'][0]->format('l'));
|
|
}
|
|
|
|
$t = 1370202281; // 2013-06-02 12:44:41 -0700 -- a Sunday
|
|
$time = PhabricatorTime::pushTime($t, 'America/Los_Angeles');
|
|
foreach ($days as $day) {
|
|
$data = CalendarTimeUtil::getTimestamps(
|
|
$u,
|
|
$day,
|
|
1);
|
|
|
|
$this->assertEqual(
|
|
$day,
|
|
$data['epoch_stamps'][0]->format('l'));
|
|
}
|
|
unset($time);
|
|
}
|
|
|
|
private function getAllDays() {
|
|
return array(
|
|
'Sunday',
|
|
'Monday',
|
|
'Tuesday',
|
|
'Wednesday',
|
|
'Thursday',
|
|
'Friday',
|
|
'Saturday',
|
|
);
|
|
}
|
|
|
|
}
|