Remove product literal strings in "pht()", part 18
[phabricator.git] / src / applications / calendar / __tests__ / CalendarTimeUtilTestCase.php
blob646badfe9c3f3a903290e311141a2c52dcf0fa78
1 <?php
3 final class CalendarTimeUtilTestCase extends PhabricatorTestCase {
5 public function testTimestampsAtMidnight() {
6 $u = new PhabricatorUser();
7 $u->overrideTimezoneIdentifier('America/Los_Angeles');
8 $days = $this->getAllDays();
9 foreach ($days as $day) {
10 $data = CalendarTimeUtil::getTimestamps($u, $day, 1);
12 $this->assertEqual(
13 '000000',
14 $data['epoch_stamps'][0]->format('His'));
18 public function testTimestampsStartDay() {
19 $u = new PhabricatorUser();
20 $u->overrideTimezoneIdentifier('America/Los_Angeles');
21 $days = $this->getAllDays();
22 foreach ($days as $day) {
23 $data = CalendarTimeUtil::getTimestamps(
24 $u,
25 $day,
26 1);
28 $this->assertEqual(
29 $day,
30 $data['epoch_stamps'][0]->format('l'));
33 $t = 1370202281; // 2013-06-02 12:44:41 -0700 -- a Sunday
34 $time = PhabricatorTime::pushTime($t, 'America/Los_Angeles');
35 foreach ($days as $day) {
36 $data = CalendarTimeUtil::getTimestamps(
37 $u,
38 $day,
39 1);
41 $this->assertEqual(
42 $day,
43 $data['epoch_stamps'][0]->format('l'));
45 unset($time);
48 private function getAllDays() {
49 return array(
50 'Sunday',
51 'Monday',
52 'Tuesday',
53 'Wednesday',
54 'Thursday',
55 'Friday',
56 'Saturday',