Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F96577674
CalendarTimeUtilTestCase.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Dec 28, 10:41
Size
1 KB
Mime Type
text/x-php
Expires
Mon, Dec 30, 10:41 (2 d)
Engine
blob
Format
Raw Data
Handle
23210706
Attached To
rPH Phabricator
CalendarTimeUtilTestCase.php
View Options
<?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'
,
);
}
}
Event Timeline
Log In to Comment