Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F1842081
OverrideFirstEventTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Size
2 KB
Subscribers
None
OverrideFirstEventTest.php
View Options
<?php
namespace
Sabre\VObject\RecurrenceIterator
;
use
Sabre\VObject\Reader
;
use
DateTime
;
class
OverrideFirstEventTest
extends
\PHPUnit_Framework_TestCase
{
function
testOverrideFirstEvent
()
{
$input
=
<<<ICS
BEGIN:VCALENDAR
BEGIN:VEVENT
UID:foobar
DTSTART:20140803T120000Z
RRULE:FREQ=WEEKLY
SUMMARY:Original
END:VEVENT
BEGIN:VEVENT
UID:foobar
RECURRENCE-ID:20140803T120000Z
DTSTART:20140803T120000Z
SUMMARY:Overridden
END:VEVENT
END:VCALENDAR
ICS;
$vcal
=
Reader
::
read
(
$input
);
$vcal
->
expand
(
new
DateTime
(
'2014-08-01'
),
new
DateTime
(
'2014-09-01'
));
$expected
=
<<<ICS
BEGIN:VCALENDAR
BEGIN:VEVENT
UID:foobar
RECURRENCE-ID:20140803T120000Z
DTSTART:20140803T120000Z
SUMMARY:Overridden
END:VEVENT
BEGIN:VEVENT
UID:foobar
DTSTART:20140810T120000Z
SUMMARY:Original
RECURRENCE-ID:20140810T120000Z
END:VEVENT
BEGIN:VEVENT
UID:foobar
DTSTART:20140817T120000Z
SUMMARY:Original
RECURRENCE-ID:20140817T120000Z
END:VEVENT
BEGIN:VEVENT
UID:foobar
DTSTART:20140824T120000Z
SUMMARY:Original
RECURRENCE-ID:20140824T120000Z
END:VEVENT
BEGIN:VEVENT
UID:foobar
DTSTART:20140831T120000Z
SUMMARY:Original
RECURRENCE-ID:20140831T120000Z
END:VEVENT
END:VCALENDAR
ICS;
$newIcs
=
$vcal
->
serialize
();
$newIcs
=
str_replace
(
"
\r\n
"
,
"
\n
"
,
$newIcs
);
$this
->
assertEquals
(
$expected
,
$newIcs
);
}
function
testRemoveFirstEvent
()
{
$input
=
<<<ICS
BEGIN:VCALENDAR
BEGIN:VEVENT
UID:foobar
DTSTART:20140803T120000Z
RRULE:FREQ=WEEKLY
EXDATE:20140803T120000Z
SUMMARY:Original
END:VEVENT
END:VCALENDAR
ICS;
$vcal
=
Reader
::
read
(
$input
);
$vcal
->
expand
(
new
DateTime
(
'2014-08-01'
),
new
DateTime
(
'2014-08-19'
));
$expected
=
<<<ICS
BEGIN:VCALENDAR
BEGIN:VEVENT
UID:foobar
DTSTART:20140810T120000Z
SUMMARY:Original
RECURRENCE-ID:20140810T120000Z
END:VEVENT
BEGIN:VEVENT
UID:foobar
DTSTART:20140817T120000Z
SUMMARY:Original
RECURRENCE-ID:20140817T120000Z
END:VEVENT
END:VCALENDAR
ICS;
$newIcs
=
$vcal
->
serialize
();
$newIcs
=
str_replace
(
"
\r\n
"
,
"
\n
"
,
$newIcs
);
$this
->
assertEquals
(
$expected
,
$newIcs
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Wed, Jan 8, 1:22 AM (1 d, 17 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
916875
Default Alt Text
OverrideFirstEventTest.php (2 KB)
Attached To
rDAVCAL DokuWiki DAVCal PlugIn
Event Timeline
Log In to Comment