Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F1821759
SupportedCalendarComponentSetTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Size
2 KB
Subscribers
None
SupportedCalendarComponentSetTest.php
View Options
<?php
namespace
Sabre\CalDAV\Xml\Property
;
use
Sabre\CalDAV
;
use
Sabre\DAV
;
class
SupportedCalendarComponentSetTest
extends
DAV\Xml\XmlTest
{
function
setUp
()
{
$this
->
namespaceMap
[
CalDAV\Plugin
::
NS_CALDAV
]
=
'cal'
;
$this
->
namespaceMap
[
CalDAV\Plugin
::
NS_CALENDARSERVER
]
=
'cs'
;
}
function
testSimple
()
{
$prop
=
new
SupportedCalendarComponentSet
([
'VEVENT'
]);
$this
->
assertEquals
(
[
'VEVENT'
],
$prop
->
getValue
()
);
}
function
testMultiple
()
{
$prop
=
new
SupportedCalendarComponentSet
([
'VEVENT'
,
'VTODO'
]);
$this
->
assertEquals
(
[
'VEVENT'
,
'VTODO'
],
$prop
->
getValue
()
);
}
/**
* @depends testSimple
* @depends testMultiple
*/
function
testSerialize
()
{
$property
=
new
SupportedCalendarComponentSet
([
'VEVENT'
,
'VTODO'
]);
$xml
=
$this
->
write
([
'{DAV:}root'
=>
$property
]);
$this
->
assertXmlStringEqualsXmlString
(
'<?xml version="1.0"?>
<d:root xmlns:d="DAV:" xmlns:cal="'
.
CalDAV\Plugin
::
NS_CALDAV
.
'" xmlns:cs="'
.
CalDAV\Plugin
::
NS_CALENDARSERVER
.
'">
<cal:comp name="VEVENT"/>
<cal:comp name="VTODO"/>
</d:root>
'
,
$xml
);
}
function
testUnserialize
()
{
$cal
=
CalDAV\Plugin
::
NS_CALDAV
;
$cs
=
CalDAV\Plugin
::
NS_CALENDARSERVER
;
$xml
=
<<<XML
<?xml version="1.0"?>
<d:root xmlns:cal="$cal" xmlns:cs="$cs" xmlns:d="DAV:">
<cal:comp name="VEVENT"/>
<cal:comp name="VTODO"/>
</d:root>
XML;
$result
=
$this
->
parse
(
$xml
,
[
'{DAV:}root'
=>
'Sabre
\\
CalDAV
\\
Xml
\\
Property
\\
SupportedCalendarComponentSet'
]
);
$this
->
assertEquals
(
new
SupportedCalendarComponentSet
([
'VEVENT'
,
'VTODO'
]),
$result
[
'value'
]
);
}
/**
* @expectedException \Sabre\Xml\ParseException
*/
function
testUnserializeEmpty
()
{
$cal
=
CalDAV\Plugin
::
NS_CALDAV
;
$cs
=
CalDAV\Plugin
::
NS_CALENDARSERVER
;
$xml
=
<<<XML
<?xml version="1.0"?>
<d:root xmlns:cal="$cal" xmlns:cs="$cs" xmlns:d="DAV:">
</d:root>
XML;
$result
=
$this
->
parse
(
$xml
,
[
'{DAV:}root'
=>
'Sabre
\\
CalDAV
\\
Xml
\\
Property
\\
SupportedCalendarComponentSet'
]
);
$this
->
assertEquals
(
new
SupportedCalendarComponentSet
([]),
$result
[
'value'
]
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Dec 24, 9:26 AM (1 d, 16 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
914331
Default Alt Text
SupportedCalendarComponentSetTest.php (2 KB)
Attached To
rDAVCAL DokuWiki DAVCal PlugIn
Event Timeline
Log In to Comment